什么是.NET异常类型的_x code字段? [英] What is the _xcode field of the .NET Exception type?
问题描述
在我的单元测试,我需要执行两个对象,预计是相同的深相等测试。在测试中,我发现在我的突破code系统类型的一些有趣的领域。 Exception._x code
是最近的一次。这里有几个关于这个领域的事实:
In my unit tests I need to perform deep equality tests of two objects, which are expected to be identical. During the tests I discover some interesting fields in system types that break my code. Exception._xcode
is the most recent one. Here are a couple of facts about this field:
- 在它被初始化为
-532459699
中的所有异常
构造,除了自定义反序列化的构造,它在哪里根本就不曾提及(感谢反射)。 - 在它没有标记
非序列化
属性。
- It is initialized to
-532459699
in all theException
constructors, except the custom deserialization constructor, where it is simply never mentioned (thanks Reflector). - It is not marked with the
NonSerialized
attribute.
鉴于上述事实,本场被重置为0的异常
对象进行反序列化,这是从它被设置为在构造函数中肯定是不同的后。
Given these facts, the field is reset to 0 after an Exception
object is deserialized, which is certainly different from what it is set to in constructors.
我想知道这是什么领域存在的理由?
I am wondering what is the raison d'être of this field?
感谢。
推荐答案
此字段用于存储COM +的异常codeS和它的价值分配给恒 _COMPlusException code
。
This field is used to store COM+ exception codes and it's value is assigned to the constant _COMPlusExceptionCode
.
这篇关于什么是.NET异常类型的_x code字段?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!