ThreadAbortException

  • Thread starter Thread starter Chris Oswald
  • Start date Start date
C

Chris Oswald

I'm trying to determine what is causing an exception in my NetCF 2.0
application. The stack trace looks like the UI is throwing the abort
exception. I can't figure out what is going on. It's not consistent
and not in the same place. Does anyone have any ideas. I do not call
thread.abort anywhere in my application.

Example Stack Trace 1 :

Error Message:ThreadAbortException
Error Stack:at Microsoft.AGL.Forms.WL.GetParent()
at System.Windows.Forms.Control.get_Parent()
at System.Windows.Forms.Control._GetContainerAutoValidate()
at System.Windows.Forms.Control.DoValidation()
at System.Windows.Forms.Control.OnLostFocus()
at System.Windows.Forms.Control.WnProc()
at System.Windows.Forms.ContainerControl.WnProc()
at System.Windows.Forms.Form.WnProc()
at System.Windows.Forms.Control._InternalWnProc()
at Microsoft.AGL.Forms.EVL.EnterMainLoop()
at System.Windows.Forms.Application.Run()
at DTC.NAFOP.Mobile.Client.Login.Startup.Main()


Example Stack Trace 2:

Error Message:ThreadAbortException
Error Stack:at Microsoft.AGL.Forms.EVL.EnterMainLoop()
at System.Windows.Forms.Application.Run()
at DTC.NAFOP.Mobile.Client.Login.Startup.Main()
 
I'm trying to determine what is causing an exception in my NetCF 2.0
application.  The stack trace looks like the UI is throwing the abort
exception.  I can't figure out what is going on.  It's not consistent
and not in the same place.  Does anyone have any ideas.  I do not call
thread.abort anywhere in my application.

Example Stack Trace 1 :

Error Message:ThreadAbortException
Error Stack:at Microsoft.AGL.Forms.WL.GetParent()
at System.Windows.Forms.Control.get_Parent()
at System.Windows.Forms.Control._GetContainerAutoValidate()
at System.Windows.Forms.Control.DoValidation()
at System.Windows.Forms.Control.OnLostFocus()
at System.Windows.Forms.Control.WnProc()
at System.Windows.Forms.ContainerControl.WnProc()
at System.Windows.Forms.Form.WnProc()
at System.Windows.Forms.Control._InternalWnProc()
at Microsoft.AGL.Forms.EVL.EnterMainLoop()
at System.Windows.Forms.Application.Run()
at DTC.NAFOP.Mobile.Client.Login.Startup.Main()

Example Stack Trace 2:

Error Message:ThreadAbortException
Error Stack:at Microsoft.AGL.Forms.EVL.EnterMainLoop()
at System.Windows.Forms.Application.Run()
at DTC.NAFOP.Mobile.Client.Login.Startup.Main()

I'll go ahead and answer my own question. I feel pretty dumb now that
i realize what I was doing. When we ported over our 1.0 application
to 2.0, I never changed the global exception handling. The error I
was seeing in my stack trace wasn't the initial unhandled exception.

1.0 Error Handling:

Try
System.Windows.Forms.Application.Run(New LoginForm)
Catch ex As Exception
' Write Error To File
End Try

How it should have been.. This is borrowed from Danial Moth.

Try
AddHandler AppDomain.CurrentDomain.UnhandledException, AddressOf
OnUnhandledException

System.Windows.Forms.Application.Run(New LoginForm)
Catch ex As Exception

End Try

Private Sub OnUnhandledException(ByVal sender As Object, ByVal e As
UnhandledExceptionEventArgs)
' Write Error
End Sub
 
Back
Top