developer
developer

Reputation: 7400

Runtime fatal error - possibly CLR bug

I would like some insight into an error I'm receiving:

Managed Debugging Assistant 'FatalExecutionEngineError' has detected a problem in 'C:\app.exe'. Additional Information: The runtime has encountered a fatal error... This error may be a bug in the CLR or in the unsafe or non-verifiable portions of the user code. Common sources of this bug include user marshaling errors for COM-interop or PInvoke, which may corrupt the stack."

I would like to understand not only the error itself, but what/how CLR may play a part, and I've never really heard of COM-intercop or PInvoke are.. so some insight into those would also be helpful.

Also, the really odd part of it all is that if I continue through the breakpoints and do not step into or over, I do not see the error. However, if I step through line by line, the error pops up! Can anyone explain why I only see it while stepping through?

Not sure what other information would be useful.. please let me know (nicely of course!) what I could add.

Thank you in advance! :)

Upvotes: 17

Views: 27042

Answers (6)

gscriptor
gscriptor

Reputation: 93

What actually helped me is to delete all breakpoints. Probably some of them were pointing to commented lines.

Upvotes: 0

Ali Ezzat Odeh
Ali Ezzat Odeh

Reputation: 2163

Well I am going to tell you about my sad story in order for others not to be trapped again in same mistake, this happened to me in case where I was calling a native C++ API continuously inside an infinite loop thread and forgetting to stop the thread when needed, sometimes this error you mentioned was exploding or an read/write protected memory exception and even worse sometimes the whole application was simply just crashing :)

That's all folks.

Upvotes: 0

Ravi
Ravi

Reputation: 1

I recently had the same error. What I noticed that I have 2 completely identical projects (Both the same). One is having this problem. So I did notice in my Project Property--> Under Compile Menu--> On the top, Configuration was set to Release. I change it back to Active(Debug) and recompile. Now it's working fine. click to see Image

Upvotes: 0

Bob Sakson
Bob Sakson

Reputation: 91

I ran into this working on a Dotnet Core project. I deleted the binaries and rebuilt, this fixed it for me. Simply doing a Clean and Build or just Rebuild had no effect.

Upvotes: 7

Vergil C.
Vergil C.

Reputation: 1104

This problem troubles me a lot too and I have not managed to find the cause, but I found a work around so I can at least continue doing my job.

For me, the problem occurs when I debug with F10 and F11 and I am exciting the method and that method returns to the feature file. So as a workaround i have put breakpoints to all the entries of the methods and when I reach the exit of the next method I go to the next on with F5, doing it that way it will not crash.

The problem seems to occur only when I return to the *.feature file from a method using F10 or F11.

I hope it helps, at least as a workaround, but I am really curious to know the actual cause of it.

Upvotes: 1

user541686
user541686

Reputation: 210525

It's most likely not a CLR bug, but probably a Heisenbug. We can't really say what's causing it, though, without seeing your code.

Try turning on Managed Debugging Assistants to figure out if some error or access violation is being suppressed.

Upvotes: 3

Related Questions