开发者

What is the _xcode field of the .NET Exception type?

In my unit tests I need to perform deep equality tests of two objects, which are exp开发者_运维技巧ected 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:

  1. It is initialized to -532459699 in all the Exception constructors, except the custom deserialization constructor, where it is simply never mentioned (thanks Reflector).
  2. It is not marked with the NonSerialized attribute.

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?

Thanks.


This field is used to store COM+ exception codes and it's value is assigned to the constant _COMPlusExceptionCode.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜