How to end a .NET thread that has a damaged call stack?

I have a thread in my application that runs code that can cause damage to the call stack (my application is a testing tool for dll).

Assuming I have a detection method, if the child thread is behaving badly, how would I stop it? From what I read, calling Thread.Abort () on the wrong thread would be equivalent to having an exception in it. I am afraid that it would not be a good idea if the call stack of the thread might get corrupted. All offers?

+5
source share
5 answers

If you use untrusted code that could damage your process, run this code in a separate process and communicate with it using interprocess communication. If you want to end untrusted code earlier, you can just kill the process.

+6
source

If the code behaves badly, it can do something, and it can affect something in the whole process, on any thread.

The most reliable solution is to start the untrusted code in a separate process, and then terminate the process if it works erroneously.

+3
source

DLL AppDomain DLL , AppDomain.DoCallBack.

+3

, : , -?

+2

accept, , Thread.Abort.

try
{
    ...
}
catch (ThreadAbortException)
{
   Thread.ResetAbort();
}
0

All Articles