All of a sudden I’m getting this error message in my inbound Web Service that’s been working fine for several days:
Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack.
The Web Service just started failing all of a sudden, and I’ve been trying to back track what’s changed, but I can’t find anything wrong here.
The behavior that I’m seeing is mighty whacky: If I run in the debugger the code will throw this exception on random spots in the Web Service method. The code comes in and the inbound object parameter looks fine and the lines of code that bonking are lines that should not be failing like straight assignments of values that the debugger shows as valid.
Even weirder at some point, things were working for a few minutes again with requests going through and the debugger going through the whole code, but then it went right back to failing again.
I can’t figure out what is different as there were no code changes between these episodes when it didn't work, then worked then not... I recompiled, I stopped IIS deleted all assemblies to ensure there are no version conflicts prior to rebooting. None of this seemed to have any effect...
Finally I rebooted the machine and now things are working correctly again, but I really can’t make any sense of this…
Anybody have any idea? I’ve searched around a bit and this error seems common, but I didn’t find a solution in any of the posts I read – most of the issues are related to straight ASP.NET and Response.Redirect related issues apparently. This is not the case here since this is a Web Service and there’s no interaction with any of the ASP.NET objects.
Is it possible that the .NET Runtime Optimization Service is doing something behind the scenes here that it shouldn't be? I'm just checking my settings now and it looks like this service is off now, but i didn't check while the failure was happening.
This sort of thing is worrisome – I hate it when you run into a problem and the answer is: Reboot the system. <g>…
Other Posts you might also like