Thread being stopped against my will.

rward01

Newcomer
Joined
Jul 17, 2003
Messages
3
Has anyone encountered an unhandled exception being thrown while stepping through the debugger? When this happends I am inside a newly created thread and the function I am in is the one pointed at by the addressof(myThread = New System.Threading.Thread(AddressOf postdata). In this case I am in postdata.

The message I am receiving while stepping through the debugger is:

"An unhandled exception of type 'System.Threading.ThreadStopException' occured in CreditBureauHTTPS.exe

Additional Information: Thread was being stopped."

I have executed the same code with no problems on two separate machines that are identical to the one I am using. One of the machines has the same version of the IDE and Framework.

I am running Visual Studio 2003 with Framework 1.1.

At one point in time, I was able to use the debugger to step through.

I have since uninstalled and reinstalled the IDE. No luck.

Any help is greatly appreciated.

Thanks in advance
 
Oddly enough, the error message has disappeared. I do not know why. What a pain. This went on for a couple of days.
 
It's back. Help! I was stepping through the code after working for several hours and it just started throwing the exception again. Anyone know how to trap why the thread is being stopped? I believe I have try catches where I need them, so I do not see how I could programmatically catch it.
 
Is it crashing at the same point every time? Do you have some sort of anti-virus program or something that could be attempting to stop your program's thread (unlikely...).
 
Just to let you know I just got this problem now too; It just came out of the blue. (I've never had this problem before)

I'm using VS.NET 2003 (Architect) with .NET Framework 1.1 as well...

I'll keep you posted if I find a solution...

Max
 
This is weird... I can't find any info on ThreadStopException in my MSDN, and Google turns up only 15 pages about it, one of them being this thread.

Are you using any third party DLLs or anything?
 
In form load

testthread = New Thread(AddressOf test)
testthread.Name = "test"
testthread.Start()


Private Sub test()
Dim a As String = "wrew"
Me.Text = "Test" 'crashes here
TextBox1.Text = "test"
Debug.WriteLine("test")
End Sub

This code works fine on my other PC and timers work fine.
 
Is the sub attempting to update the UI? If so that is probably the problem. UI elements should only be modified from the forms main thread. Search these forums for some examples on using Form.Invoke - not near VS at the moment so I can't dig up the help.
 
Yes that's the problem, I just figured it out. It especially comes up if you have a hyperthreaded cpu.
 
I've asked you that before ...

When using threads allways make them ThreadSafe, use delegates for example... specially if the thread modifies th UI...

:D
 
smae prob not modifying ui or using threads

I don't yet know how to use threads in .net so maybe I'm inadvetently doing something with them though I have no code that deals with threads at all.

The class(3) containing the following code is called by a class(2) which is called by the UI form(1), with no attempt to modify or update the UI(1) directly.

class3
................
..
cls4 = New class4(temp, sOutputFile, iPageNo, iSideLength, blChosenSide)
'Thread Was Being Stopped' exception occurs here
cls4.Make()
................
end class

Class(2) however does raise an event that allows the UI(1) to refresh itself.

class2
................
..
Dim cls3 As new class3(sInputFile, sOutputFile)
cls3.Make()
cls3.dispose()
cls3 = Nothing
RaiseEvent done(Me, sOutputFile)' in this event's handler, the UI(1) calls its refresh method
................
end class

(The identifier names have been simplified and much code ommitted for readbility)

The same exception is thrown ad I don't know why.

Please,
help me.


ps I just reallised that the acrobat interop which I'm using may be using threads. Any help with this would be great as I'm not controlling the threading in the COM if it is using it.

Also the word printing system is used prior to this code which may also use threading, D'oh!

Cheers Will
 
Last edited:
It might be too late but can help others. One way of overcoming this is to hide your local and auto windows in the IDE. This way I managed to step through in my code in the IDE.
 
Hi everyone,
I had this same error which had me going for about a day. After reading gyurisc's comment about the debugging windows, I cleared all the watches I had going in my window and all of a sudden the error disappeared and my step through performance came back.

Just in case anyone else has this problem, try doing that.

Thanks,
Simon
 
Back
Top