6

I'm getting the following exception:

Exception of type ThreadAbortException occurred: System.Threading.ThreadAbortException: ThreadAbortException 
at System.Threading.EventWaitHandle.WaitOne(Int32 millisecondsTimeout, Boolean exitContext) 
at MyCode.ProcessEvents() 

And I'm confused about how it could happen. I'm sure that I'm not aborting this particular thread, though my code could be aborting a different one (including the thread that sets the WaitHandle). This leads me to believe that either the framework is raising the exception or a threadabortexception for a different thread is bleeding out into this one somehow. Neither of which I thought were possible.

So, If I am not calling Thread.Abort() on this thread, how can it end up with a ThreadAbortException?

CJBS
  • 15,147
  • 6
  • 86
  • 135
Daz Eddy
  • 332
  • 2
  • 15
  • So what's your question. I can't get your point exactly. Is your question how can runtime throw exception in a thread waiting at `WaitOne`? – Sriram Sakthivel Sep 24 '13 at 13:50
  • Have clarified the question: I was of the opinion that the only way for a thread to get this exception was if I call thread.abort on it. But I'm not, so i'm baffled how this stack trace is even possible – Daz Eddy Sep 24 '13 at 16:02
  • Could you post some repro with small sample program? – Sriram Sakthivel Sep 24 '13 at 16:05
  • Is this relevant? http://stackoverflow.com/q/7629986/56778 – Jim Mischel Sep 24 '13 at 18:34
  • Thanks for the responses. Unfortunately, I haven't repro'd the issue. The trace is from logs on a customer server and it happens quite rarely. In my googling, I did see mention of asp.net being able to abort threads but this is c# running on a windows mobile device so didn't think it applied. – Daz Eddy Sep 25 '13 at 08:20

0 Answers0