您好, 欢迎来到 !    登录 | 注册 | | 设为首页 | 收藏本站

在哪里了解VS调试器的“魔术名称”

在哪里了解VS调试器的“魔术名称”

这些是编译器的未记录实现细节,并且随时可能更改。(更新:有关GeneratedNames.cs 最新详细信息,请参见C#源代码;下面的描述有些过时了。)

但是,由于我是一个好人,因此以下是其中一些详细信息:

如果您有一个未使用的局部变量被优化器删除,则无论如何我们都会将调试信息发送到PDB中。我们将后缀粘贴__Deleted$到此类变量上,以便调试器知道它们在源代码中,但未在二进制文件中表示。

由编译器分配的临时变量插槽的名称为CS $ X $ Y,其中X是“临时种类”,Y是到目前为止分配的临时数量。临时类型为:

0 --> short lived temporaries
1 --> return value temporaries
2 --> temporaries generated for lock statements
3 --> temporaries generated for using statements
4 --> durable temporaries
5 --> the result of get enumerator in a foreach
6 --> the array storage in a foreach
7 --> the array index storage in a foreach.
@H_403_13@

8到264之间的临时类型是多维数组的其他数组索引存储。

高于264的临时类型用于涉及固定字符串的固定语句的临时类型。

特殊生成的编译器生成名称是为:

1 --> the iterator state ("state")
2 --> the value of current in an iterator ("current")
3 --> a saved parameter in an iterator
4 --> a hoisted 'this' in an iterator ("this")
5 --> a hoisted local in an iterator
6 --> the hoisted locals from an outer scope
7 --> a hoisted wrapped value ("wrap")
8 --> the closure class instance ("locals")
9 --> the cached delegate instance ("CachedAnonymousMethodDelegate")
a --> the iterator instance ("iterator")
b --> an anonymous method
c --> anonymous method closure class ("DisplayClass")
d --> iterator class
e --> fixed buffer struct ("FixedBuffer")
f --> anonymous type ("AnonymousType")
g --> initializer local ("initLocal")
h --> query expression temporary ("TransparentIdentifier")
i --> anonymous type field ("Field")
j --> anonymous type type parameter ("TPar")
k --> auto prop field ("backingField")
l --> iterator thread id
m --> iterator finally ("Finally")
n --> fabricated method ("FabricatedMethod")
o --> dynamic container class ("SiteContainer")
p --> dynamic call site ("Site")
q --> dynamic delegate ("SiteDelegate")
r --> com ref call local ("ComRefCallLocal")
s --> lock taken local ("LockTaken")
@H_403_13@

生成魔术名称的模式是:P<N>C__SI其中:

  • 对于缓存的委托和显示类实例,P为CS $,否则为空。
  • N是与事物关联的原始名称(如果有)
  • C是上面列出的字符1到s
  • S是描述性后缀(“当前”,“状态”等),因此在读取元数据时不必记住上面的表。
  • 我是一个可选的唯一编号

解决方法

如果您曾经使用过Reflector,您可能会注意到C#编译器会生成类型,方法,字段和局部变量,这些应由调试器进行“特殊”显示。例如,以“ CS
$”开头的局部变量不会显示给用户。对于匿名方法的关闭类型,自动属性的后备字段等,还有其他特殊的命名约定。

我的问题:在哪里可以了解这些命名约定?有人知道一些文档吗?

我的目标是使PostSharp 2.0使用相同的约定。

喜欢与人分享编程技术与工作经验,欢迎加入编程之家官方交流群!
1 --> the iterator state ("state")
2 --> the value of current in an iterator ("current")
3 --> a saved parameter in an iterator
4 --> a hoisted 'this' in an iterator ("this")
5 --> a hoisted local in an iterator
6 --> the hoisted locals from an outer scope
7 --> a hoisted wrapped value ("wrap")
8 --> the closure class instance ("locals")
9 --> the cached delegate instance ("CachedAnonymousMethodDelegate")
a --> the iterator instance ("iterator")
b --> an anonymous method
c --> anonymous method closure class ("DisplayClass")
d --> iterator class
e --> fixed buffer struct ("FixedBuffer")
f --> anonymous type ("AnonymousType")
g --> initializer local ("initLocal")
h --> query expression temporary ("TransparentIdentifier")
i --> anonymous type field ("Field")
j --> anonymous type type parameter ("TPar")
k --> auto prop field ("backingField")
l --> iterator thread id
m --> iterator finally ("Finally")
n --> fabricated method ("FabricatedMethod")
o --> dynamic container class ("SiteContainer")
p --> dynamic call site ("Site")
q --> dynamic delegate ("SiteDelegate")
r --> com ref call local ("ComRefCallLocal")
s --> lock taken local ("LockTaken")
@H_403_13@

生成魔术名称的模式是:P<N>C__SI其中:

  • 对于缓存的委托和显示类实例,P为CS $,否则为空。
  • N是与事物关联的原始名称(如果有)
  • C是上面列出的字符1到s
  • S是描述性后缀(“当前”,“状态”等),因此在读取元数据时不必记住上面的表。
  • 我是一个可选的唯一编号

解决方法

如果您曾经使用过Reflector,您可能会注意到C#编译器会生成类型,方法,字段和局部变量,这些应由调试器进行“特殊”显示。例如,以“ CS
$”开头的局部变量不会显示给用户。对于匿名方法的关闭类型,自动属性的后备字段等,还有其他特殊的命名约定。

我的问题:在哪里可以了解这些命名约定?有人知道一些文档吗?

我的目标是使PostSharp 2.0使用相同的约定。

喜欢与人分享编程技术与工作经验,欢迎加入编程之家官方交流群!

8到264之间的临时类型是多维数组的其他数组索引存储。

高于264的临时类型用于涉及固定字符串的固定语句的临时类型。

特殊生成的编译器生成名称是为:

生成魔术名称的模式是:P<N>C__SI其中:

如果您曾经使用过Reflector,您可能会注意到C#编译器会生成类型,方法,字段和局部变量,这些应由调试器进行“特殊”显示。例如,以“ CS
$”开头的局部变量不会显示给用户。对于匿名方法的关闭类型,自动属性的后备字段等,还有其他特殊的命名约定。

我的问题:在哪里可以了解这些命名约定?有人知道一些文档吗?

我的目标是使PostSharp 2.0使用相同的约定。

8到264之间的临时类型是多维数组的其他数组索引存储。

高于264的临时类型用于涉及固定字符串的固定语句的临时类型。

特殊生成的编译器生成名称是为:

1 --> the iterator state ("state")
2 --> the value of current in an iterator ("current")
3 --> a saved parameter in an iterator
4 --> a hoisted 'this' in an iterator ("this")
5 --> a hoisted local in an iterator
6 --> the hoisted locals from an outer scope
7 --> a hoisted wrapped value ("wrap")
8 --> the closure class instance ("locals")
9 --> the cached delegate instance ("CachedAnonymousMethodDelegate")
a --> the iterator instance ("iterator")
b --> an anonymous method
c --> anonymous method closure class ("DisplayClass")
d --> iterator class
e --> fixed buffer struct ("FixedBuffer")
f --> anonymous type ("AnonymousType")
g --> initializer local ("initLocal")
h --> query expression temporary ("TransparentIdentifier")
i --> anonymous type field ("Field")
j --> anonymous type type parameter ("TPar")
k --> auto prop field ("backingField")
l --> iterator thread id
m --> iterator finally ("Finally")
n --> fabricated method ("FabricatedMethod")
o --> dynamic container class ("SiteContainer")
p --> dynamic call site ("Site")
q --> dynamic delegate ("SiteDelegate")
r --> com ref call local ("ComRefCallLocal")
s --> lock taken local ("LockTaken")
@H_403_13@

生成魔术名称的模式是:P<N>C__SI其中:

  • 对于缓存的委托和显示类实例,P为CS $,否则为空。
  • N是与事物关联的原始名称(如果有)
  • C是上面列出的字符1到s
  • S是描述性后缀(“当前”,“状态”等),因此在读取元数据时不必记住上面的表。
  • 我是一个可选的唯一编号

解决方法

如果您曾经使用过Reflector,您可能会注意到C#编译器会生成类型,方法,字段和局部变量,这些应由调试器进行“特殊”显示。例如,以“ CS
$”开头的局部变量不会显示给用户。对于匿名方法的关闭类型,自动属性的后备字段等,还有其他特殊的命名约定。

我的问题:在哪里可以了解这些命名约定?有人知道一些文档吗?

我的目标是使PostSharp 2.0使用相同的约定。

喜欢与人分享编程技术与工作经验,欢迎加入编程之家官方交流群!

生成魔术名称的模式是:P<N>C__SI其中:

如果您曾经使用过Reflector,您可能会注意到C#编译器会生成类型,方法,字段和局部变量,这些应由调试器进行“特殊”显示。例如,以“ CS
$”开头的局部变量不会显示给用户。对于匿名方法的关闭类型,自动属性的后备字段等,还有其他特殊的命名约定。

我的问题:在哪里可以了解这些命名约定?有人知道一些文档吗?

我的目标是使PostSharp 2.0使用相同的约定。

生成魔术名称的模式是:P<N>C__SI其中:

其他 2022/1/1 18:16:03 有526人围观

撰写回答


你尚未登录,登录后可以

和开发者交流问题的细节

关注并接收问题和回答的更新提醒

参与内容的编辑和改进,让解决方法与时俱进

请先登录

推荐问题


联系我
置顶