Thursday, 20 August 2009

A Couple of Issues Discovered While Playing with .NET RIA Services

Installing Windows 7 (which is a breath of fresh air after the nightmare I've had with Vista) and reinstalling all my software on different PCs probably wasn't my best idea given that I had a talk, which needed research, looming. As a result of the best part of a week rebuilding a ton of PCs, I left playing with .NET RIA Services (currently a July 2009 Preview with a 'use at your own risk' 'Go Live' license) much too late (Note to self: You ALWAYS underestimate how long it will take to prep a presentation. Take note!)


The talk, which I gave last night, was An Introduction to PRISM and .NET RIA Services at Vista Squad, which has just renamed itself to "Edge UG" - Die Vista die! ;-) For those who missed it - don't worry - it wasn't one of my best efforts, and although folks were kind about it afterwards and tweeted nice things, the reality is the complexity levels of different sections were too at variance with each other and because I was running out of time I skipped an important initial .NET RIA Services demo which then made the demo I did give confusing as hell, mainly because I skipped about too much (not literally - stop making your own jokes up at the back there!)


Bad preparation aside, when I was researching .NET RIA Services I hit a couple of problems in the most basic demo's almost immediately :-(


The first problem was that the generated proxy code class for Silverlight which the .NET RIA Services produce as part of the Server project build process wasn't being recognised by my Silverlight code that needed to use it. I was getting errors whenever I tried to reference the client-side Proxy classes, or even just add a 'using' statement for the generated class namespace.


After a couple of hours banging my head against a brick wall (this stuff had been working fine on another PC, I just hadn't twigged that the other PC was configured with different software!) I raised a question in the lively .NET RIA Services support forums and thanks to help from Colin Blair discovered the problem was down to my having installed JetBrains Resharper.


It seems that Resharper and .NET RIA Services don't play well together, although in this case I think Resharper is doing what you'd expect it to do (the generated classes aren't included as part of the project and only show up when you click on 'Show hidden files' - so why should Resharper recognise they're there just because some clever hackery is going on within Visual Studio?). There are reports this might be fixed in Resharper version 5 but in the meantime including the file in the project gets you up and running.

Build failure screenshot when Resharper is installed


The other issue I hit was to do with using a System.ComponentModel.DataAnnotations reference to resolve the [Key] attribute required on my POCO properties that I wanted to bind to in my Silverlight-generated class. It turns out that .NET RIA Services installs a newer version of the DataAnnotations class (version 99!) but I was referencing the original 3.5 version. Doh!


DataAnnotations dll version numbers (Add Reference dialog)

Hopefully this blog post will alert others. I found a few folks with the 'cannot resolve Key attribute' DataAnnotations problem when I did a Bing search, but never any responses on what the cause might be. Big thanks to Colin for diagnosing the issues almost immediately.

Wednesday, 5 August 2009

Monthly Catch Up

Yikes! It's been over a month since my last post. Alas most of my blogging these days seems to be in the form of micro-blogging via Twitter


The Silverlight project I've been working on finally launched last week (hope to have the URL for the public version to show any day now) and I'm in that strange limbo-land known as being 'between contracts'. It's nice to actually have some time to catch up and reflect on the work done over the last 3 months. Bizarrely my first week off seems to have been even more hectic than when I was working full-time!


There's been the usual user group meetings - UK Azure User Group, Silverlight User Group and VistaSquad, with me recording/editing video for all of them over the last 3 weeks (I would particularly recommend watching the video of Bert Craven talking about Easyjet's vision for improving their customers' airport user experience and how they're using Azure to achieve this).


The last few weeks saw the official UK launch of Silverlight 3 and Expression Studio 3 and the latest weekend-packed ALT.NET Conference. This latter event saw announcements about the launch of several new ALT.NET initiatives such as The ALT.NET Society and The Alternative Network Group. It all feels a bit like a Monty Python-esque 'People's Liberation Front of Judea' vs 'Judean People's Liberation Front' situation is developing - let's hope not!


The UK Silverlight Launch event was good fun (with free champagne and canapes too) and it was good to network with folks who've worked with Silverlight, and to see some good customer demo's. But the launch felt like a bit of a missed opportunity to me because the audience seemed to mainly comprise knowledgeable geeks, where the launch talks were more geared towards 'overview' material. I felt that the real target audience for the launch should have been journalists from computer design magazines and professional bloggers rather than the group of developers it appeared to be (and of course, by saying this, I'm admitting I probably shouldn't have been invited there myself :-(). You can see video's of all the talks at the launch event here or of course there's my own video of the one-hour 'reprise' of the event for the Silverlight User Group here


Microsoft have got Silverlight BRANDING so right. Everyone's aware of it, where nobody outside the Microsoft dev world seems to know what WPF is! So it's frustrating that they don't seem able to follow through on the MARKETING side of things.


The initial version of the official US Silverlight 3 launch site SeeTheLight.com, was pre-advertised with a countdown clock and much hoop-la about how great it was going to be. The eventual launch was a calamatous affair, with the Silverlight implementation being so bad it was taken down within hours and replaced with an HTML version that's still there a month later.


It's frustrating for those of us who love the technology, but keep seeing these 'shoot yourselves in the foot' scenarios happening around us! And even the Microsoft developers don't seem convinced about the technology either. At the ALT.NET Conference, in a session on 'The Future of Web Technologies' Silverlight was dismissed VERY quickly, with a brash (and seemingly inaccurate) 'Office 2010 isn't using it which says all you need to know about Microsoft's confidence in it'.


There's a lot of work needs doing to get developers behind the technology and even pointing out statements from the likes of Scott Guthrie about its long-term strategic future, the evolution of products like .NET RIA Services, MEF for Silverlight, XBox support, iPhone support through MonoTouch etc isn't getting people past the perception that 'Its just a weaker version of Flash that's on far fewer desktops and not worth the time looking at because Microsoft will probably abandon it'. There's a lot of work to be done in changing people's attitudes!


If I felt the UK launch for Silverlight was a bit of a missed opportunity, I had no such reservations about the ALT.NET UK Conference 2009. It was a total blast from start to finish. Kicking off with ALT.NET Beers and some lively 'Park Bench' sessions with the infamous SerialSeb holding court, the weekend got off to a good start. I missed most of the Open Space Coding day (but looking forward to attending the Azure-themed one in Birmingham later this month) but by all accounts people got a lot out of it. And then there was the Open Space conference itself. Lots of lively debate and discussion. I thought this event was even better than the last one although the inability to stream the sessions (my HP Dv2 laptop refused to connect to Conchango's wireless router, even though my iPhone had no such problems) was frustrating. Kudos to Alan Dean, Ian Cooper, Ben Hall, Serial Seb, Michelle Flynn and all the generous sponsors for all their hard work in putting together such a great event.


On the 19th August I'm giving an introductory talk on PRISM and RIA .NET Services for VistaSquad. As of yesterday, there were apparently only 7 places left so if you want to come along you need to be quick. You can reserve a place here


Tonight sees what will probably be the first of many Tesco TJAM developer events, with Tesco allowing sign-up for use of their API and presenting ideas from customers about what they'd like to see implemented. Should be fun!


In the meantime, I'm busy redesigning/re-implementing the company web site which is suffering badly from 'The Cobbler's Childrens' Shoes' syndrome (ie it's crap because I've had no time to sort it out when paying work keeps distracting me!) I shall be using Silverlight 3 and PRISM of course, and it's a good excuse to catch up on all the Silverlight 3 activity now that the Silverlight 2 project I've been working on has been (pretty effortlessly) migrated to Silverlight 3.


I'm still waiting for the good Silverlight 3 books to appear. Since my last blog entry, strongly criticising Introducing Silverlight 3, only one new title has been published. Apress have released Accelerated Silverlight 3 and it's a huge disappointment. If I'd checked who the author was (the same author as wrote Silverlight in the Enterprise - never have so many words at such high cost been used to say so little) I'd have realised what I was letting myself in for. Although the book's cover and back page talk all the time about 'Silverlight 3' as soon as you read the actual content the talk is only of 'Silverlight 3 beta' and 'Expression Studio 3 Preview'. The book was out-of-date even before its publication date, and its dry, 'let's just cut and paste MSDN content' style isn't going to turn anybody on to Silverlight. If you're looking for a Silverlight 3 book and need one today, my recommendation would be to get the 'early access' chapters from either Hello! Silverlight 3, Essential Silverlight 3 or Silverlight 3 In Action.