Delta Engine Blog

AI, Robotics, multiplatform game development and Strict programming language

Debugging Silverlight in Visual Studio



Couple of tips if you want to debug Silverlight applications in Visual Studio. Please note I have not worked myself with Silverlight much, I was just observing my colleagues and helping them out when they were unable to debug their Silverlight code.

  • First of all: Visual Studio 2005 is NOT supported, you need Visual Studio Orcas Beta 1 (see my last 2 posts about it)

  • You need the VS_SilverlightTools_Alpha_Setup.exe setup file to get started with silverlight and allow debugging

  • The XAML designer view never seems to work and it usually does not even show up. If you want to hide it, switch the design and xaml views and then click the button on the very right to hide the design view on the bottom.

  • Most importantly: If debugging does not work for you make sure that:

    • Close ALL your instances of Firefox and Internet Explorer first. Then start the debugger of VS Orcas with F5 and let it create a new instance of your browser. This is VERY important because if you leave the browser open and start to set some breakpoints and debug the application, it won't work. Every time you press F5 in VS Orcas to start the project a new browser instance must be created, else debugging is just skipped and you just see the website, the debugger ends immediately. I tested it with Internet Explorer first, but Firefox is ok too if you can live with the constant opening and closing. For me it is much more comfortable to use Firefox for browsing and then Internet Explorer for testing the Silverlight stuff.

    • Your project/website/etc. does not contain any spaces. Like the .NET 3.5 installation there are still issues with spaces. Just make sure there are none. This wasn't a problem at my PC, but on a Vista machine it caused problems.

    • Exceptions seem to be ignored and there seems to be some Exception-Eating-Monster in the Silverlight runtime because no matter what happens or what you throw, it will not be passed to the debugger. Instead it just seems to end the debugging session and shows the page as far as it got. It is probably best to catch all exceptions yourself and display them in some label or flush them to a log file ..

Comments are closed