Hello i'm becoming mad at trapping this exception:
EventType clr20r3, P1 execwinservice.exe, P2 1.0.0.0, P3 45eec745, P4
system.data, P5 2.0.0.0, P6 4333aea2, P7 2323, P8 11, P9
system.invalidoperationexception, P10 NIL
it's windows service made in vb.net 2005, every thing it's in try
catch blocks but this exception is uncaught.
Machine is win2003, .Net 2.0.
Protected Overrides Sub OnStart(ByVal args() As String)
' Add code here to start your service. This method should set
things
' in motion so your service can do its work.
Dim currentDomain As AppDomain = AppDomain.CurrentDomain
'AddHandler currentDomain.UnhandledException, AddressOf
MyHandler
AddHandler Thread.GetDomain.UnhandledException, AddressOf
MyHandler
Try
Dim t As New System.Timers.Timer(2000)
'Abilitazione del timer
t.Enabled = True
'aggiunta di un Handler per controllare l'evento
TimerFired
AddHandler t.Elapsed, AddressOf TimerFired
.......
.......
End Sub
Sub MyHandler(ByVal sender As Object, ByVal args As
UnhandledExceptionEventArgs)
Dim Ex As Exception = DirectCast(args.ExceptionObject,
Exception)
'Console.WriteLine("MyHandler caught : " + e.Message)
Dim InnerEx As Exception = Ex.InnerException
Dim Message As String = Ex.Message
Do While Not (InnerEx Is Nothing)
Message += InnerEx.Message + "|"
InnerEx = InnerEx.InnerException
Loop
Message = Message & "|" & Ex.StackTrace
MsgBox(Message)
FileOpen(1, System.Windows.Forms.Application.StartupPath &
"\Executor.log", OpenMode.Append, OpenAccess.Default,
OpenShare.Shared)
WriteLine(1, Date.Now.ToLocalTime & ": **CRASH **: " &
Message)
FileClose(1)
End Sub