S
Sam Miller
Normally the debugger (visual studio .net environment) is good at pointing
out the line of code that caused an exception.... except when that code is
executed as part of a timer handler. In the case of the code below the
exception is handled by a little dialog that tries to tell me how to switch
on jitDebugging. (which, if I am doing it correctly doesn't seem to help).
All three options are checked under
Tools->Options->Debugging->"Just-In-Time". The commented out version
doesn't seem to even generate an exception (or write anything to the
console). Any ideas? pointers to MSDN articles?
Module startup
Sub main()
Dim myTest As New testTimer()
Application.Run()
End Sub
End Module
'-----------------------------------------------------------------
'Imports System.Timers
Public Class testTimer
'WithEvents pollTimer As System.Timers.Timer
WithEvents pollTimer As System.Windows.Forms.Timer
Sub New()
'pollTimer = New System.Timers.Timer()
pollTimer = New System.Windows.Forms.Timer()
'pollTimer.Interval = 100
'pollTimer.AutoReset = True
pollTimer.Enabled = True
End Sub
'Sub TimerElapsed(ByVal sender As System.Object, ByVal e As
ElapsedEventArgs) Handles pollTimer.Elapsed
Sub TimerTick(ByVal sender As System.Object, ByVal e As EventArgs) Handles
pollTimer.Tick
Console.WriteLine("hello")
Throw New System.Exception()
End Sub
End Class
out the line of code that caused an exception.... except when that code is
executed as part of a timer handler. In the case of the code below the
exception is handled by a little dialog that tries to tell me how to switch
on jitDebugging. (which, if I am doing it correctly doesn't seem to help).
All three options are checked under
Tools->Options->Debugging->"Just-In-Time". The commented out version
doesn't seem to even generate an exception (or write anything to the
console). Any ideas? pointers to MSDN articles?
Module startup
Sub main()
Dim myTest As New testTimer()
Application.Run()
End Sub
End Module
'-----------------------------------------------------------------
'Imports System.Timers
Public Class testTimer
'WithEvents pollTimer As System.Timers.Timer
WithEvents pollTimer As System.Windows.Forms.Timer
Sub New()
'pollTimer = New System.Timers.Timer()
pollTimer = New System.Windows.Forms.Timer()
'pollTimer.Interval = 100
'pollTimer.AutoReset = True
pollTimer.Enabled = True
End Sub
'Sub TimerElapsed(ByVal sender As System.Object, ByVal e As
ElapsedEventArgs) Handles pollTimer.Elapsed
Sub TimerTick(ByVal sender As System.Object, ByVal e As EventArgs) Handles
pollTimer.Tick
Console.WriteLine("hello")
Throw New System.Exception()
End Sub
End Class