views:

478

answers:

2

Hi, I am using Visual Studio 2008 Express and am writing unit tests where there are many expected unhandled exceptions. This cause numerous exception assistant popups to display when running these tests in the debugger. I have disabled the exception assistant in the VS options, but a different unhandled exception dailog pops up instead. I know it is possible to get rid of these with Visual Studio Professional, but how do you do this with the express edition? By the way, I am using Assert.Throws instead of the ExpectedException attribute (NUnit), which causes this, but I want to use the Assert.Throws instead. Thanks!

+1  A: 

In the Debug menu, go to Exceptions (Ctrl+Alt+E). From here you can tell the debugger not to break when an exception is thrown. Just uncheck all the boxes for the lazy option, or go digging for the specific exceptions you don't want it to break on.

Note however, that this may not be what you want to happen under normal debugging situations, so don't forget to turn it back on later if you're trying to debug something & want to find the exception.

Edit: My apologies, even though its written several times in the question (including the title), I failed to notice you were talking about the express edition... teach me for skim reading the question. Not sure if the above works or not in express edition, so it might still be worth a try.

Edit 2: Ok, looks like the Exceptions dialog is still available in express edition.

Alconja
Thanks for your post. Get this, I just noticed it: in Visual Web Developer Express the Exceptions dialog is NOT available. However, in Visual C# Express, the dialog IS available! Of course I need this to work in Visual Web Developer.... Why would MS do this?
jrupe
@jrupe - According to that link I added in my 2nd edit, it *should* be available in web developer express. ...maybe its just not in the menu by default? Did you try the Ctrl+Alt+E shortcut?
Alconja
Yeah, I tried Ctrl+Alt+E, but it does not work...
jrupe
-1 since he was obviously talking about Express.
Martin
Alconja
Umm, no, your answer doesn't answer the question ... you misread the question, just like you said I did ... I guess it is ok for you to downvote people because they misread the question, but other people can't do it to you? That sounds right.
Martin
Alconja
A: 

I'll take a guess that you're encountering one of the following:

  • You're throwing a "special" exception like StackOverflowException that the runtime handles differently from other exceptions.
  • Your test code creates a new thread, and on that thread an exception is thrown.
280Z28