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

L

Les Caudle

I'm getting this exception in some 3rd party code.

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

I'd like to be able to just ignore the exception as:

try {
// run 3rd party code
} catch {

}

But I still get an exception in a try for the enclosing method, even though I
can see that fhe code able does enter the catch (so it should ingore the
exception at that point).

What's the correct way to catch and ignore some strange error like this. I've
never gotten an error of this type before, that behaves so strangely.
 
G

Göran Andersson

Les said:
I'm getting this exception in some 3rd party code.

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

I'd like to be able to just ignore the exception as:

try {
// run 3rd party code
} catch {

}

But I still get an exception in a try for the enclosing method, even though I
can see that fhe code able does enter the catch (so it should ingore the
exception at that point).

What's the correct way to catch and ignore some strange error like this. I've
never gotten an error of this type before, that behaves so strangely.

That error comes from the inability to read the call stack, and is
probably caused by the code that is catching an exception from unmanaged
code. You should look at the inner exception to find the original cause.

You might not be able to prevent the error from showing, as you have a
debugger installed on your computer. A regular user doesn't have a
debugger, so the exception goes to the calling code. If you close the
message, the exception should bubble up to the calling code just as if
you didn't have a debugger installed.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top