views:

76

answers:

2

When I get an exception in code called by Silverlight whilst in debug mode I cannot F5 or F10 past the expection. It's like VS (2008) gets stuck on the exception and can't get past it. I have to close the application and restart.

I am using Vs2008 Team Edition for Software Developers.

Anyone else experienced this? Know any workarounds or settings to check?

Thanks, Mark

A: 

I haven't used Silverlight, but this sounds like normal debugging behaviour. When debugging C# apps in VS, when you reach an unhandled exception the debugger stops on that line.

Your choices are:

  1. Implement some exception handling (try/catch).

  2. Not sure if this feature is available yet with Silverlight, but can you drag the arrow that points to the currently executing line to a different line?

Richie Cotton
Thanks for taking the time to answer. This is also occurring in a try catch. I can move the arrow to a different line, but on continuing (F10) it then jumps back to the exception. I think this is specific to my environment as this doesn't happen on the machines of other devs working on the same solution
Mark Cooper
A: 

Try handling the App.UnhandledException event in your App.cs file, then do Debug.WriteLine( e.Exception.ToString() ) and set e.Handled to true. If you're lucky you can watch the output window in VS and see what's going on. Also do a try/catch like Richie suggested and use a Debug.WriteLine() there too. Also you can try catching the exception earlier on - hit Ctrl + Alt + E in VS and click the "thrown" checkbox next to managed/clr exceptions. That way the debugger will break as soon as the error happens and you might have better luck.

But this really shouldn't be happening. Whenever VS breaks on an exception you should be able to hit F5 and continue running the code. If none of those hacks helps you could you try creating a small sample of what's causing the behavior? Are you doing anything crazy? ;)

James Cadd
I think this must be corruption in my VS environment, not the solution. Other devs in my team don't get this issue.
Mark Cooper