Sunday, 28 September 2008


From time to time I read or hear people talk about how unimportant we must be. In a universe so vast, on a planet so tiny, creatures like us must surely be insignificant indeed. And this, somehow, makes life pointless.

I find it to be quite the contrary. In a universe so vast, so void of life, tiny creatures like us, living on such a tiny planet so far from anything else must certainly be incredibly significant. Our existence would not make any sense otherwise.

The point? When things seem pointless, fundamentally they're anything but!

Wednesday, 24 September 2008

Fix for ASP.NET MVC Preview 5 bug with Visual Studio 2008

We've had some trouble using the latest ASP.NET MVC Preview 5. For reasons unknown any attempt to open a view (e.g. Default.aspx, not the code-behind) in Visual Studio 2008 would cause a fatal .NET runtime error and the Visual Studio process would simply be killed. Dead. Gone.


I spent a good amount of time trying to figure out why this could be, and though there were a few leads on the web none of the proposed solutions out there fixed the problem. So, I asked the senior developer on my team, Steve Friend, to have a look. Sic' em, Steve!

Steve noticed that Scott Guthrie's Preview 5 Example Application wouldn't cause any problems at all. Nor would any MVC project added to the same solution as Guthrie's application. However, all other MVC projects created from scratch with Visual Studio would suffer from the symptom described at the top of this post.

Steve examined the differences between ScottGu's application and a 'fresh' MVC app, and discovered that removing two of the DLLs from the fresh MVC app's /bin folder solved the problem. He documented this on our internal wiki, and I've copied-and-pasted his fix here. Thanks Steve!

Creating a new project
In Visual Studio create a new MVC project (File > New > Project, then select Visual C# > Web then select ASP.Net MVC Web Application). This will create a fairly large default project containing a number of folders and files relating to the MVC pattern structure (i.e. models, views and controllers).

Once you have done this you will need to build the project and create a new website in IIS (see IISSetup for details of how to do this), but before you do that, run through the instructions below to avoid the bug that seems to ship with default projects.

The bug
If you double click on any view page (i.e. a aspx page) in order to edit it in Visual Studio the application crashes.

The fix
In the solution explorer select "Show all files" to reveal the bin folder. In there you will the following dlls (and possibly more, if you have already built your project/solution):

* Microsoft.Web.Mvc.dll
* System.Web.Abstractions.dll
* System.Web.Mvc.dll
* System.Web.Routing.dll

Delete "System.Web.Abstractions.dll" and "System.Web.Routing.dll".

You know you're not a Digital Native when...

... you get up in the morning, tune into Norwegian online radio (NRK P3, to be specific), and find yourself genuinely surprised - when stepping out of the shower ten minutes later - that they're playing Norwegian rock band Dum Dum Boys. "But, but... we're in the UK?"

Perhaps another few hours of chasing Zs is called for.