thread-exceptions

Thread exception on SelectedNode = .Nodes[0]

Why do i get System.Threading.ThreadStateException? void setupTree(TreeView tv, MyObj o) { tv.Invoke((MethodInvoker)delegate { tv.Nodes.Clear(); tv.Nodes.Add("<root>").Tag = o; tv.SelectedNode = tv.Nodes[0]; //it happens here }); } ...

Using ThreadExceptionEventHandler: determine which thread caused the exception

Using the Application.ThreadExceptionEventHandler, is it possible to determine which thread caused the exception (the thread id)? The same question applies to using the AppDomain.UnhandledExceptionEventHandler to catch non-UI thread exceptions. If the answer is no, is there any other way to determine which thread raised the unhandled e...

Why do AppDomain exceptions invariably terminate the application?

This is related to a previous question. What I'm trying to understand now is how come UI thread exceptions can be prevented from terminating the application while non-UI exceptions can't be. For reference, see this example. Most importantly, what I would like to be able to do in that case is "silently" terminate the process - without ...

How to throw a checked exception from a java thread?

Hey, I'm writing a network application, in which I read packets of some custom binary format. And I'm starting a background thread to wait for incoming data. The problem is, that the compiler doesn't let me to put any code throwing (checked) exceptions into run(). It says: run() in (...).Listener cannot implement run() in java.lang.Runn...

[Android] My "MyException" which shows Toast causes trouble while thrown in threads. How should I reorganize Exception handling?

I have written my own Exception (MyException) and implemented Logging and showing Error Messages in Form of Toasts. Here is the shortform of it... public class MyException extends Exception { public MyException(String msg) { Looper.prepare(); Toast.makeText(Controller.getInstance().getApplicationContext(), msg , Toast.L...