I recently updated my laptop from Vista 32bit with Visual Studio 2005/2008 installed to Windows 7 x64 with only Visual Studio 2008 installed. So I don't know if this is a "Windows 7" issue or just a configuration within visual studio.
My problem is that exeptions in the Form_Load() event get swallowed without notifing me, which makes it harder to debug errors because sometimes I don't even notice that an exception occures.
Let's say I have this code (Code is VB.NET but commentary C# style, because the so-syntax highlighter doesn't recognize ' as a commentary sign)
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles MyBase.Load
// Outside the Debugger the exception triggers the default
// "Unhandled Exception" Dialog which is correct.
// Withing 2008 IDE the debugger doen not break like it
// should. However the exception still occures because
// this text is printed to the Output Window:
// A first chance exception of type 'System.Exception'
// occurred in ExceptionTest.exe
Throw New Exception("This Exception gets swallowed")
End Sub
Private Sub Button1_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles Button1.Click
// This exception causes the Debugger to break at this line
Throw New Exception("This Exception works fine")
End Sub
End Class
I found a suggestion to Check the "thrown" checkbox in the Exception Dialog ("CTRL+D,E"). If I do so the debugger breaks at the Form_Load() exception as I want it but it also breaks at every handled exception, e.g.:
Try
DoSmthThatThrowsArgumentException() // Debugger breaks here
Catch ex as ArgumentException
LogWriter.Write(ex.ToString())
End Try
Anyone has a clou how to configure VS2008 Debugger to behave right in the Form_Load() event? According to this post it looks like that this is something that came suddenly with visual studio 2008.