AccessViolationException outside Visual Studio?

别来无恙 提交于 2019-12-25 04:52:04

问题


I'm developing a small C# winforms application that consumes an unmanaged C++ library. I have no access to the code of this library.

If I'm in Visual Studio and I runt my application, do my calls to the library everything is working find. Once I run CTRL + F5 I get an AccessViolationException. I did some testing, created another winforms application in .NET 2.0 (others were in .NET 4.0) and there I don't receive the AccessViolationException. So I thought i'd create a .net 2.0 class library in my .net 4.0 solution and consume that class lib. This didn't help, still I had the AccessViolationException.

Tried setting allow unsafe code, optimize code on and off but that didn't help. Why am I getting the AccessViolationException once I'm out of debug mode?

Thanks


回答1:


I just stumbled upon the same issue. To reproduce the problem in the debugger, I had to go to:

Tools\Options Debugging\General

and disable: Suppress JIT optimization on module load (managed only).

Of course the problem would only appear for a optimized code.



来源:https://stackoverflow.com/questions/2679248/accessviolationexception-outside-visual-studio

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!