When an exception happens after calling Invoke, .NET shows the stack trace as if the error happens while calling Invoke.
Example below: .NET will say the error happen in UpdateStuff instead of UpdateStuff -> BadFunction
Is there a way to catch the "real" exception and show the correct stack trace?
Private Sub UpdateStuff()
If (Me.InvokeRequired) Then
Me.Invoke(New UpdateStuffDelegate(AddressOf UpdateStuff))
Return
End If
Badfunction()
End Sub
Private Sub BadFunction()
Dim o As Object
o.ToString()
End Sub