Thread exception Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack

Im facing a problem- Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack.
 Im working on Windows Application .net VS 2008.( im not using Response.Redirect). I got error when the code that is in thread is completed and call myThread.Abort() method. Any idea t solve the problem?
sigmatec_pkAsked:
Who is Participating?
 
daryalConnect With a Mentor Commented:
why you are aborting the thread if the thread is complete?
0
 
daryalCommented:
Hello,
are you using a third party tool or dll or unmanaged code (like c) somewhere?
If this is the case, then I think the problem can be related with the unmanaged code.
0
 
daryalCommented:
Also, please note that your thread may be terminated before you call thread.abort.
0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
sigmatec_pkAuthor Commented:
@daryal::
thanks for repy. No, im not using any third party dll or unmanaged code. I ve debugged code it executed fine, on thread Completion method when i abort the thread myThread.Abort it goes to catch block.
0
 
sigmatec_pkAuthor Commented:
@daryal:

is it not necessary to abort the started thread?
0
 
daryalCommented:
As far as I know, if the thread completes, there is no need to abort it.
In fact, aborting a thread is usable in a few cases and it is done on a purpose, not for every thread.
0
All Courses

From novice to tech pro — start learning today.