2
private void button1_Click(object sender, EventArgs e)
{
    ///IDE will notify me of this exception  
    throw new Exception();
}

private void Form1_Load(object sender, EventArgs e)
{
    //IDE will not notify me of this exception  
    throw new Exception();


    //code will not execute  
    MessageBox.Show("test");
}

why?

----------------------EDITED----------------------
the correct answer is what ChrisA mentioned. some quotes from microsoft :

This is a known bug with x64 versions of Windows and the way exceptions are handled. One way to work around this issue while debugging is to go to the Debug -> Exceptions and select 'Thrown' for for the exception types you are interested in. This will stop the debugger when the exception is first hit (and before Windows eats it up).


This bug was closed as "External" because this behavior results from how x64 version of Windows handle exceptions. When a user mode exception crosses a kernel transition, x64 versions of Windows do not allow the exception to propagate. Therefore attached debuggers are unaware of the fact that an exception occured resulting in the debugger failing to break on the unhandled exception.

Unfortunately where is nothing that the Visual Studo team can do to address this, it is the result of operating system design. All feedback regarding this issue should be addressed to the Windows team; however the Windows team considers this to be the "correct" operating system design, and considers the x86 behavior to be "incorrect".


This hotfix has not undergone full testing. Therefore, it is intended only for systems or computers that are experiencing the exact problem that is described in the one or more Microsoft Knowledge Base articles that are listed in "KB Article Numbers" field in the table at the end of this e-mail message. If you are not sure whether any special compatibility or installation issues are associated with this hotfix, we encourage you to wait for the next service pack release. The service pack will include a fully tested version of this fix. We understand that it can be difficult to determine whether any compatibility or installation issues are associated with a hotfix. If you want confirmation that this hotfix addresses your specific problem, or if you want to confirm whether any special compatibility or installation issues are associated with this hotfix, support professionals in Customer Support Services can help you with that.

Community
  • 1
  • 1

1 Answers1

0

Are you developing on an x64 machine?

If so, you might like to have a look at this.

That thread also refers to a very detailed explanation of the whole issue.

This, and another show stopper (for me anyway, the workarounds didn't work for me, or my colleague) on x64, resulted in a rebuild of my dev box with win7 x86.

The problems have all gone away now. But it's very disappointing.

ChrisA
  • 4,163
  • 5
  • 28
  • 44
  • yes! that was awesome! I edit the question so it would be a reference here. –  Dec 18 '10 at 18:02