Is it possible to restart a console application from a thread?
You can restart a completely new instance of a console application, in a
completely new console, from a thread.
Note: saying "from a thread" is superfluous. *Everything* your program
does, it does so "from a thread". Even if you never explicitly create or
use a thread, and only have a single thread, you still have that one
thread.
Now, keep in mind that when you start a new process of your console
application, it doesn't run into the same console window that the current
process is running in. You can't start a new process in your current
console until the previous one has finished, and once your previous one
has finished, it loses the ability to create a new process (obviously

).
So, it really depends on what you're really trying to do.
IMHO, the *correct* way to deal with this issue is to put an exception
handler around the code you wrote that could throw an exception. Either
handle the exception in a meaningful way within the thread, or provide
some mechanism to report the exception back to the main controlling
thread, as has been suggested to you already. Either way, the exception
handler needs to be in the code that is running on the thread where the
exception is generated.
As a simple example: every thread has some sort of entry point. If you
create the thread explicitly, the entry point is the method you use to
create the delegate used for the thread. If you don't create the thread
explicitly, then you're in some sort of async callback, or event handler,
or something like that and again, you've provided a delegate to some other
component for the purpose of being called an an appropriate time. Either
way, the most simple example of handling the exception in that thread
would be to put the try/catch around the code in the method used to create
that delegate.
Also note: it seems to me that there are two kinds of exceptions:
"expected" and "unexpected". Now, I may be overgeneralizing a little, but
I feel that you should only be getting "expected" exceptions. That is,
you have written code that you know, because of user input or current
state of the computer or whatever, might throw an exception. In that
case, you should be able to come up with a suitable fallback plan if and
when an exception occurs. This might be a matter of reporting the error
to the user, requiring the user to provide correct input, or simply
failing silently.
On the other hand, an exception that is "unexpected" generally reflects an
error in your own code. If you are getting exceptions for which you don't
feel there is a good fallback plan, and instead you think the right
solution is to just terminate your application and start over, well...that
suggests to me that in fact you have bugs in your code and/or design.
IMHO, it is better to fix that rather than try to come up with some kludge
that shuts everything down and restarts the application again.
Pete