System.ExecutionEngineException失败System、ExecutionEngineException

2023-09-02 20:48:53 作者:心在旅途

我一直在试图找出更多关于这个问题,我没有多少运气。我一直在读应用程序不应该有这样的错误上来,尽管这是所有罚款和花花公子,它并没有告诉我什么可能导致这个错误显示出来。

I've been trying to find out more about this problem and I'm not having much luck. I keep reading that applications should not have this error come up and although that's all fine and dandy, it doesn't tell me what can cause this error to show up.

我知道这个问题是非常广泛的,因为我敢肯定,可以有多种原因造成这个错误,所以我会尽力缩小下来一点。

I know this question is very broad as I'm sure there can be multiple causes for this error so I'll try to narrow it down a bit.

我在VS2003工作的开发使用C ++的应用程序。NET

I'm working in VS2003 developing an application that uses C++.NET

该应用程序使用大多非托管code和小管理code(归因于垃圾收集沉重的干扰)。所以我想评分95%的非托管,5%的管理

The application uses mostly unmanaged code and little managed code (due to heavy interference by the garbage collector). So I'd rate it 95% unmanaged, 5% managed

我读的地方,在CLR存储不稳定/车/不正确的非托管code能陷入困境的部分使得它腐败,引发此错误。

I've read somewhere that unstable/buggy/incorrect unmanaged code can mess up parts of the CLR memory rendering it corrupt and throwing this error.

由于95%的应用程序是不受管理的,我不知道从哪里开始寻找。 也许几类,托管和非托管之间的互动? 那么编组的数据托管到非托管? 一个糟糕的空指针可能会导致这种故障? 还有什么其他问题可能导致此?数组索引出界?怎么样一个空对象?

Since 95% of the application is unmanaged, I'm not sure where to start looking. Maybe the few classes that interact between managed and unmanaged? What about marshalling data from managed to unmanaged? Can a bad null pointer cause this failure? What other problems can cause this? Array Index out of bounds? What about a Null Object?

任何信息/文件/条,可以给可能的原因一个不错的列表中System.ExecutionEngine失败将AP preciated!

Any information/paper/article that can give a nice list of possible causes for the System.ExecutionEngine failure would be appreciated!

可能的原因/场景清单 -

List of possible causes/scenarios -

Argument C ++和C# 之间的不匹配 While使用反射 在WCF服务尝试这里返回一个IList或IEnumerable的的这里 使用性能分析工具 使用汇编性病指令 调用:: FreeLibrary则()多次 .NET剪贴板要求 使用统一框架 使用错误的编组 使用 INotifyPropertyChanged的 Argument mismatch between C++ and C# While using reflection WCF service tries to return an IList or IEnumerable here here Using Profiling tools using the std instruction in assembler calling ::FreeLibrary() multiple times .NET Clipboard calls using the Unity Framework Using the wrong marshaling Using INotifyPropertyChanged

可能的解决方法/解决方案 -

Possible workarounds/solutions -

禁用并发垃圾回收

推荐答案

这不应该太认真,但我设法得到这个例外有一些乐趣与反思,而:

This should not be taken too seriously, but I managed to get this exception while having some fun with reflection:

typeof(IntPtr).GetField("Zero").SetValue(null, new IntPtr(666));