Windows Forms Topics include: windows forms, controls, components and designers

Go Back  Xtreme .NET Talk > .NET > Windows Forms > Thread being stopped against my will.


Reply
 
Thread Tools Display Modes
  #1  
Old 07-17-2003, 04:18 PM
rward01 rward01 is offline
Newcomer
 
Join Date: Jul 2003
Posts: 3
rward01 is on a distinguished road
Default Thread being stopped against my will.

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
Reply With Quote
  #2  
Old 07-18-2003, 09:41 AM
rward01 rward01 is offline
Newcomer
 
Join Date: Jul 2003
Posts: 3
rward01 is on a distinguished road
Default

Oddly enough, the error message has disappeared. I do not know why. What a pain. This went on for a couple of days.
Reply With Quote
  #3  
Old 07-19-2003, 12:11 PM
rward01 rward01 is offline
Newcomer
 
Join Date: Jul 2003
Posts: 3
rward01 is on a distinguished road
Default

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.
Reply With Quote
  #4  
Old 07-19-2003, 03:55 PM
Volte Volte is offline
Neutiquam Erro

Preferred language:
C# and VB.NET
 
Join Date: Nov 2002
Posts: 2,171
Volte is on a distinguished road
Default

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...).
Reply With Quote
  #5  
Old 10-09-2003, 02:19 PM
Surge_Max Surge_Max is offline
Newcomer
 
Join Date: Oct 2003
Posts: 1
Surge_Max is on a distinguished road
Default

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
Reply With Quote
  #6  
Old 10-11-2003, 05:19 PM
EK1 EK1 is offline
Freshman
 
Join Date: Aug 2003
Posts: 28
EK1 is on a distinguished road
Default

Anyone figure out what this issue is? I have the same problem.
Reply With Quote
  #7  
Old 10-11-2003, 05:27 PM
AlexCode's Avatar
AlexCode AlexCode is offline
Guest

Preferred language:
VB.net & C#
 
Join Date: Jul 2003
Location: Portugal
Posts: 931
AlexCode is on a distinguished road
Default

What about VolteFace asked?

Do u have any AV or FireWall active?
Did you made you thread safe?
Reply With Quote
  #8  
Old 10-11-2003, 05:37 PM
Volte Volte is offline
Neutiquam Erro

Preferred language:
C# and VB.NET
 
Join Date: Nov 2002
Posts: 2,171
Volte is on a distinguished road
Default

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?
Reply With Quote
  #9  
Old 10-12-2003, 01:48 AM
AlexCode's Avatar
AlexCode AlexCode is offline
Guest

Preferred language:
VB.net & C#
 
Join Date: Jul 2003
Location: Portugal
Posts: 931
AlexCode is on a distinguished road
Default

Maybe de project or some code would help...
Reply With Quote
  #10  
Old 10-12-2003, 07:34 AM
EK1 EK1 is offline
Freshman
 
Join Date: Aug 2003
Posts: 28
EK1 is on a distinguished road
Default

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.
Reply With Quote
  #11  
Old 10-12-2003, 08:52 AM
PlausiblyDamp's Avatar
PlausiblyDamp PlausiblyDamp is offline
Ultimate Contributor

Preferred language:
C#, VB
 
Join Date: Sep 2002
Location: Lancashire, UK
Posts: 6,346
PlausiblyDamp is on a distinguished road
Default

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.
__________________
Posting Guidelines FAQ Post Formatting

Intellectuals solve problems; geniuses prevent them.
-- Albert Einstein
Reply With Quote
  #12  
Old 10-12-2003, 09:34 AM
EK1 EK1 is offline
Freshman
 
Join Date: Aug 2003
Posts: 28
EK1 is on a distinguished road
Default

Yes that's the problem, I just figured it out. It especially comes up if you have a hyperthreaded cpu.
Reply With Quote
  #13  
Old 10-14-2003, 06:17 AM
AlexCode's Avatar
AlexCode AlexCode is offline
Guest

Preferred language:
VB.net & C#
 
Join Date: Jul 2003
Location: Portugal
Posts: 931
AlexCode is on a distinguished road
Default

I've asked you that before ...

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

Reply With Quote
  #14  
Old 02-23-2004, 10:06 AM
willg willg is offline
Newcomer
 
Join Date: Feb 2004
Posts: 1
willg is on a distinguished road
Default 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 by willg; 02-24-2004 at 04:20 AM.
Reply With Quote
  #15  
Old 07-30-2004, 06:28 AM
gyurisc gyurisc is offline
Newcomer
 
Join Date: Jul 2004
Posts: 1
gyurisc is on a distinguished road
Default

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.
Reply With Quote
  #16  
Old 11-22-2004, 05:48 PM
DigitalMatrix DigitalMatrix is offline
Newcomer
 
Join Date: Nov 2004
Posts: 1
DigitalMatrix is on a distinguished road
Default

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
Reply With Quote
  #17  
Old 10-25-2005, 05:11 AM
bonstio bonstio is offline
Newcomer
 
Join Date: Oct 2005
Posts: 1
bonstio is on a distinguished road
Default

OMG this solved my problem too. What a daft problem it is though!

Thanks all
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to call public sub of form running in worker thread from main thread JLSEsq Windows Forms 1 01-26-2006 11:07 AM
The best way to pass parameters (thread safe) to a method called in a new thread? hrabia General 1 08-15-2005 11:14 AM
reastarting stopped thread alemargo Windows Forms 3 01-12-2004 12:36 PM
Restarting a stopped thread. Darren66 General 8 07-03-2003 01:35 AM

Advertisement:

Powered by liquidweb