poniedziałek, 5 maja 2008

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

No i stało się:

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


skąd to? Po poszukiwaniach, kombinacjach, znalazłem:
re: Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack
by shakeel khan December 10, 2006 @ 4:59 pm

Hi,
I am getting same problem with "Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack."
And always occurs even if there is no error
I used finally block and initialize bool variable in catch block and used in finally block.
Have a look code

try
{
Response.Redirect(Request.Path + "?result=submitted");

// if you using Response.Redirect or Server.Transfer in Try block you will get these error
"Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack." It’s .Net bugs.

}

catch
{
this._response = false;
// Response.Redirect(Request.Path + "?result=error");
}
finally
{
if(_response)
Response.Redirect(Request.Path + "?result=submitted");
else
Response.Redirect(Request.Path + "?result=error");
}
Eh :-) I wiecie co jest najgorsze? Że faktycznie przeniesienie redirect-a poza try..catch pomogło.

1 komentarz:

DotNetGuts pisze...

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

http://dotnetguts.blogspot.com/2009/01/unable-to-evaluate-expression-because.html