Click here to Skip to main content
15,845,681 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
hello Guys

want to know about this Exception in C#


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

no matter when it comes becoz task was completed but in 2nd way i think matter is very important when it comes............
Posted
Updated 11-Sep-13 22:22pm
v4
Comments
Sriram Bala 12-Sep-13 2:48am    
Hi, I felt difficult to understand your question. You are getting an error message thats is clear, however do you have anylogic written inside try.. catchblock or it is thrown from the method called from some other place. brief your question to understand clearly.
Shubh Agrahari 12-Sep-13 2:58am    
ohh sry there is huge amount of code but i only want to know about Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack. Exceptoin why occur becoz the one thing is that when this ex occur there is no matter with program execution.
Sergey Alexandrovich Kryukov 12-Sep-13 3:16am    
Are you serious? You did not show even the line where the exception was thrown. The right approach would be this: simplify your code down, to the code sample which would be complete and short, yet manifesting the problem... Provide comprehensive exception information as well.
—SA
Sergey Alexandrovich Kryukov 12-Sep-13 3:17am    
By the way, your try-catch block makes no sense at all, as it is equivalent to not handling exceptions at all, in the same context. Or did you do it only for debugging purpose?
—SA
Shubh Agrahari 12-Sep-13 3:20am    
i think u all r getting ma q.s wrong actually my main q.s is to know that why and in which condition this occurs....

1 solution

are you using throw function inside the catch method ?

throw must but used inside the try method.

what You can do, for exemple

C#
try
{
 x++;
 if (x == 3)
 {
   throw new exception(); //( correct me if i'm wrong)
 }
}
catch(Exception ex)
{
  Console.Write(ex.message); // to show error type
  x = 2
}

//if an error occurs, of if x == 3, the catch method will be executed.


does it answer your question ?
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900