日期:2014-05-20  浏览次数:20753 次

C# winform应用程序异常
C#开发的winform程序(C#调用C++的一个dll),framework为2.0.50727.3053,运行到执行C++里一个方法时winform程序自动关闭无法捕捉异常,
看系统的事件日志:执行引擎错误
.NET Runtime version 2.0.50727.3053 - Fatal Execution Engine Error (7A097706) (80131506)


------解决方案--------------------
很有可能是C++ dll中越界访问内存了。

找到下面的资料
This is an exception generated by the CLR when it detects that the garbage collected heap is corrupted. The most typical source of this kind of corruption is unmanaged code writing to, say, a managed array and overflowing the array boundary.

If you have no idea what unmanaged code might be doing this then you're in for a pretty rough ride debugging this. Fwiw, virus scanners are pretty notorious for this, especially products from Symantec.


来自
http://stackoverflow.com/questions/2209197/fatal-execution-engine-error-7a09770680131506
------解决方案--------------------
问题在于“C++的一个dll”,尝试对此dll进行调式
------解决方案--------------------
用專業調試器去調試,,,例如ILSpy_Master
------解决方案--------------------
也许C#调用时传了非法地址进去DLL里面。
------解决方案--------------------
指针转成对象时,需要
使用 ref 和 Marshal 申请空间
------解决方案--------------------
转换C++的函数写正确了没
------解决方案--------------------
把你的C++头文件里的函数声明贴出来看看吧。应该是C#声明与C++不匹配