debuggingvisual-studio-2013first-chance-exception

Visual Studio 2013 not thrown user-unhandled exceptions


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.


Solution

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