12
votes

When there is an exception thrown in my program, and it is unhandled, I expect the debugger to break in my program and show me what the problem is. This doesn't happen. Instead, my program simply exits, and debugging stops.

If I look at the debugging output, I can see my exception:

A first chance exception of type 'System.NullReferenceException' occurred in System.dll

I am using Visual Studio 2010, Visual Basic, writing a simple WinForms app. The code doesn't matter in this case... it happens with any exception that I've seen so far.

I've read a lot online about doing to the Debug menu and clicking Exceptions and enabling "break on unhandled user exception", but I don't see this option. I think this advice is for VS2008, and is no longer applicable.

I should also note that I'm not running any unit tests. I have never set them up. However, I have read that perhaps the unit tester is swallowing my exceptions?

Please advise me on how to change the behavior of Visual Studio, so I can track down these unhandled exceptions.

Thank you for your time.

2
Are you running a 64-bit version of Windows?Cody Gray
@Cody, no I am using Windows XP SP3, 32 bit.Brad

2 Answers

17
votes

The item may not be in the menu, which you can fix by customising the menu and adding the item to the debug menu.

You should also be able to get to the exceptions menu using CTRL + ALT + E

You need to tick the box in the "Thrown" column for Common Language Runtime exceptions (CLR)

0
votes

i had the same issue. i opened the exceptions dialog and clicked the "Restore the list to the default settings" button and now it breaks on unhandled exceptions correctly.

there's probably a bug with upgrading from 2013.