Solved

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

Posted on 2011-02-17
6
1,238 Views
Last Modified: 2012-06-27
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?
0
Comment
Question by:sigmatec_pk
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
6 Comments
 
LVL 10

Expert Comment

by:daryal
ID: 34924071
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
 
LVL 10

Expert Comment

by:daryal
ID: 34924081
Also, please note that your thread may be terminated before you call thread.abort.
0
 

Author Comment

by:sigmatec_pk
ID: 34924448
@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
Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

 
LVL 10

Accepted Solution

by:
daryal earned 500 total points
ID: 34924486
why you are aborting the thread if the thread is complete?
0
 

Author Comment

by:sigmatec_pk
ID: 34940445
@daryal:

is it not necessary to abort the started thread?
0
 
LVL 10

Expert Comment

by:daryal
ID: 34942331
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

Featured Post

Learn by Doing. Anytime. Anywhere.

Do you like to learn by doing?
Our labs and exercises give you the chance to do just that: Learn by performing actions on real environments.

Hands-on, scenario-based labs give you experience on real environments provided by us so you don't have to worry about breaking anything.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
Computer science students often experience many of the same frustrations when going through their engineering courses. This article presents seven tips I found useful when completing a bachelors and masters degree in computing which I believe may he…
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
Introduction to Processes

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question