Peter McGrattan’s Weblog

Silverlight, WCF, ASP.NET, AJAX, Graphics, RIA

Not hitting breakpoints in Silverlight 2.0 Beta 1 project

Posted by petermcg on April 15, 2008

I ran into an issue today when debugging a Silverlight project in Visual Studio 2008.  I had previously been able to hit breakpoints in the project and hadn’t changed any settings, but for some reason it had stopped working.

I knew there was a checkbox in the Property Pages of the hosting web site under Start Options that has to be enabled for breakpoints to be hit when debugging Silverlight Applications, this checkbox is checked by default when you create a new Silverlight Application as shown below:

Default Start Options

Turns out when I checked the properties of my hosting web site project, this checkbox was unchecked – the cause of my breakpoints not being hit, re-enabling solves the problem :

Post-Copy Start Options

But as I said I had previously been able to hit breakpoints in the project and hadn’t changed any settings.  The only thing I had done after closing Visual Studio 2008 last night was to move the solution into another directory under the default Projects folder.

With a bit of investigating it turns out that when I moved the solution to a new folder and then opened the copy in Visual Studio, the Silverlight Debuggers checkbox under Start Options had been cleared.

To re-create firstly create a new Silverlight Application project with the default ‘Web Site’ host and confirm the checkbox is checked under Start Options in the web site’s Property Pages.  Then close Visual Studio and move or copy the whole solution, to the same folder even.  If you made a copy and open the original project the checkbox will still be checked and your breakpoints will work, if you open the copy or the moved solution then the checkbox will have been cleared.

Interestingly the checked value of the Silverlight Debuggers checkbox is not kept for copies with a normal ASP.NET web site when Silverlight is not involved either.  It would be good to find out if this is by design or if I’ve missed something?

Advertisements

Sorry, the comment form is closed at this time.

 
%d bloggers like this: