KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I have heard from a very discerning person that an exception being thrown (and not caught) in a thread is being propagated to the parent thread. Is that true? I have tried something like this but couldn't catch the exception in the creating thread. static void Main(string[] args) { ParameterizedThreadStart pts = new ParameterizedThreadStart(ThreadMethod); try { Thread t = new Thread(pts); t.Start(new object()); Console.ReadLine(); } catch (Exception ex) //the exception is not caught { Debugger.Break(); } } static void ThreadMethod(object @object) { Thread.Sleep(2000); throw new IndexOutOfRangeException(); Thread.CurrentThread.Abort(); }
Tags (comma-separated)
Save Edits
Cancel