.netpeverify

Question about peverify errors


When I run the peverify utility against my .NET exe, I get a few errors (classes, methods renamed):

[IL]: Error: [myapp.exe : namespace.class::method1][offset 0x00000027]
Instruction cannot be verified.

[IL]: Error: [myapp.exe : namespace.class::method2][offset 0x00000027]
Instruction cannot be verified.

[IL]: Error: [myapp.exe : namespace.class::method3][offset 0x00000313]
Instruction cannot be verified.

Is this something I should be concerned about? These methods all use the unsafe keyword, which I'm assuming is the cause for this error. But I can't find any documentation about this error online, so any thoughts would be much appreciated. Thanks!


Solution

  • Well, it is not because you used the unsafe keyword. It is because you wrote code that compiled because you used unsafe. Yes, peverify will balk at such code. it is the very nature of unsafe. You can't have your cake and eat it too here.