Visual Studio 2013 not thrown user-unhandled exceptions

851 views Asked by At
private void Form1_Load(object sender, EventArgs e)
{
    Directory.CreateDirectory(null);
    MessageBox.Show("hnjkh");
}

When I run above sample code, VS2013 says A first chance exception of type 'System.ArgumentNullException' occurred in mscorlib.dll. Then remaining code not work.

Is this behaviour normal?

If this behaviour is normal, when a first chance exception occured, sometimes I can not find location of the problem. Debugging in this way is very hard for large projects.

How can i find exact line of the problematic code?

I don't want to toggle exceptions for every type of exception. Also when I toggle exceptions then it is thrown even user handled. I want to show only user unhandled exceptions.

2

There are 2 answers

0
volkans80 On BEST ANSWER

The problem discussed here. When i move codes to button1_click then it works normally. Thanks to Hans Passant.

1
user3671127 On

Turn on the Exceptions thrown for Common Language Runtime Exceptions

Debug->Exceptions Select the thrown check box next to "Common Language Runtime Exceptions"