[英]What does “Illegal use of type 'void' in signature” mean?
I have a compiler that's producing an assembly. 我有一个正在生成程序集的编译器。 When I load the assembly and try to run a method on an object whose class is in that assembly, it throws an exception:
当我加载程序集并尝试在其类位于该程序集中的对象上运行方法时,它将引发异常:
System.InvalidProgramException: Common Language Runtime detected an invalid program.
System.InvalidProgramException:公共语言运行时检测到无效程序。
As error messages go, this is only exactly as informative as UR COMPILER SUXX0RZ LOLOLOL!!!
随着错误消息的流逝,这仅与
UR COMPILER SUXX0RZ LOLOLOL!!!
完全一样UR COMPILER SUXX0RZ LOLOLOL!!!
Looking it up on MSDN says the same thing: there's something wrong with the compiler. 在MSDN上查找时表示的是同一件事:编译器有问题。
So I tried running PEVerify on the generated assembly and got a slightly more useful message: 因此,我尝试在生成的程序集上运行PEVerify,并得到了一条稍微有用的消息:
[MD]: Error: Illegal use of type 'void' in signature.
[MD]:错误:在签名中非法使用“ void”类型。 [token:0x11000002]
[令牌:0x11000002]
Unfortunately, it doesn't say anything beyond that, such as what signature has an illegal void . 不幸的是,它什么也没说,例如什么签名有非法的void 。 You know, the kind of stuff that's useful for tracking down reported errors...
您知道,这对于跟踪报告的错误很有用...
Opening it up in ILDASM, I don't see any obviously wrong void-ness hanging around, so what's the next step? 在ILDASM中打开它,我看不到任何明显错误的空隙,所以下一步是什么? Where do I go from here to figure out what my compiler is doing wrong?
我从哪里去找出我的编译器做错了什么?
You can use /TOKENS
parameter to IL DASM. 您可以对IL DASM使用
/TOKENS
参数。 That make IL DASM to show token's values as comments. 这使得IL DASM可以将令牌的值显示为注释。 Given token's value from PEVerify error message, you can easily locate problem element of assembly.
从PEVerify错误消息中获得令牌的值,您可以轻松地找到程序集的问题元素。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.