什么是.NET异常类型的_x code字段? [英] What is the _xcode field of the .NET Exception type?

查看:106
本文介绍了什么是.NET异常类型的_x code字段?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的单元测试,我需要执行两个对象,预计是相同的深相等测试。在测试中,我发现在我的突破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:

  1. 在它被初始化为 -532459699 中的所有异常构造,除了自定义反序列化的构造,它在哪里根本就不曾提及(感谢反射)。
  2. 在它没有标记非序列化属性。
  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.

鉴于上述事实,本场被重置为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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆