After many hours working with this error in a application in VB NET, i find the solution trapping the error in VB NET
using this:
Sub UnhandledExceptionEventRaised(ByVal sender As Object, ByVal e As UnhandledExceptionEventArgs)
If e.IsTerminating Then
Dim o As Object = e.ExceptionObject
MessageBox.Show("Error: " & o.ToString)
Debug.WriteLine(o.ToString) ' use EventLog instead
End If
End Sub
Public Sub New()
MyBase.New()
AddHandler AppDomain.CurrentDomain.UnhandledException, AddressOf UnhandledExceptionEventRaised
Application.EnableVisualStyles()
Application.DoEvents()
'This call is required by the Windows Form Designer.
InitializeComponent()
End Sub
In my application the problem occurs when the thread is closing because a tcpip connection are closing, and this interrupt an sql query execution. This, generate a exception similar to describe here. I think that all the people that have the same problem, search all the procedures without try and catch, because this problem occurs when the trapping errors system in your application is not good implemented.
Sincerely