Silverlight Generic Xaml causes VS2008 to quit


I have a reproducible case of VS 2008 just exiting without provocation, warning or information. It’s begun occurring since I installed the latest Silverlight 3.0 Tools for VS and let the Windows automatic updater installer install IE 8.

The step to reproduce and a workaround follow:

1) Create a Silverlight application using the wizard. I chose to use the development web server rather than an IIS hosted ASP.NET application though I don’t think this makes any difference. This creates two projects in a solution called something like SilverlightApplication1 and SilverlightApplication1.Web

2) Now add a generic.xaml file to the SilverlightApplication1 project. Normally generic.xaml will reside in a ‘themes’ sub-folder but it doesn’t make any difference where the file is located. You can do it ‘properly’ if you want. The generic.xaml file is usually associated with a Silverlight class library rather than an application. In fact its in this context that I first saw this issue but it the issue arises whether generic.xaml is created in an app or a class library. Also, I’ve not added any Xaml to the generic.xaml file but it doesn’t make any difference as a file containing valid Xaml causes the same issue. Again, this is how I first encountered the issue.

3) Check the file properties have been set correctly: Build action is Page and the Custom build tool is something like MSBuild:MarkupCompilePass1 and save the project. Make sure only the solution is open in VS 2008 and there there are no files open.

4) Close the project and re-open.

5) Right mouse-click on one of the projects (try doing on both) and select the properties option on the context menu. VS 2008 whirs for a few moments the just disappears.

So that’s creating the problem and it’s clear the issue is the generic.xaml file. It turns out there are a couple of ways to workaround the issue.

6) Double-click MainPage.xaml from the application project. Now you can open the properties window VS 2008 will not disappear.

7) Close the MainPage.xaml file then change the Build action on the generic.xaml to None. This invalidates the Xaml but also addresses the issue. Close VS 2008 and open the solution once again. Now access a project’s properties to try and reproduce the problem.

Here’s a video of me going through these steps: video

Information and Links

Join the fray by commenting, tracking what others have to say, or linking to it from your blog.


Other Posts

Write a Comment

Take a moment to comment and tell us what you think. Some basic HTML is allowed for formatting.

Reader Comments

Be the first to leave a comment!