Visual Studio does not throw exceptions on Form_Load event

I recently upgraded my laptop with Vista 32bit using Visual Studio 2005/2008 installed on 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 in visual studio.

My problem is that the exceptions in the Form_Load () event get swallowed without warning, making it difficult to debug the errors because sometimes I don't even notice that an exception is happening.

Let's say I have this code (Code is VB.NET, but C # style comment because syntax marker doesn't recognize "as comment")

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 "dropped" checkbox in the Exceptions dialog ("CTRL + D, E"). If I do this, the debugger breaks on the Form_Load () exception as I want it, but it also breaks on every exception handled, like this:

Try
   DoSmthThatThrowsArgumentException() // Debugger breaks here
Catch ex as ArgumentException
   LogWriter.Write(ex.ToString())
End Try

      

Does anyone have a clou how to set up the VS2008 Debugger to behave correctly in the Form_Load () event? According to this post , it looks like it came up unexpectedly with visual studio 2008.

+2
debugging .net exception visual-studio


source to share


No one has answered this question yet

See similar questions:

0
if expression with no result in c # VS 2012
0
DataGridView not populating in C #

or similar:

1419
Using Git with Visual Studio
1104
.gitignore for Visual Studio projects and solutions
989
Can you get Visual Studio to run as administrator on Windows 8?
815
Difference between Build Solution, Rebuild Solution and Pure Solution in Visual Studio?
801
Should I add the Visual Studio .suo and .user files to the original control?
726
How can I add an existing directory tree to a project in Visual Studio?
558
Writing to the Visual Studio Output Window
140
Visual Studio: how to break handled exceptions?
1
The number of query values ​​and target fields do not match. Error message
0
Opening SQL connection in Windows .NET application, starting, not closing



All Articles
Loading...
X
Show
Funny
Dev
Pics