You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is rather exotic IL code but it does execute without issues on the CLR.
This difference seems to come down to the approach used to build the initial ILAst model. The current decompiler processes instructions in the order in which they appear in the body. However, the older engine used a different approach as can be seen here: https://github.com/icsharpcode/ILSpy/blob/v2.4/ICSharpCode.Decompiler/ILAst/ILAstBuilder.cs#L313
The older decompiler processes instructions in an order more reminiscent of that of the actual execution flow.
Details
Product in use: ILSpy
Version in use: 8.0-preview4 and 2.4
The text was updated successfully, but these errors were encountered:
That IL code is invalid according to the ECMA spec. ILSpy currently uses a simple linear single pass to determine the stack sizes and types.
The .NET runtime uses a significantly more complex process where individual blocks are potentially even "reimported" multiple times to gradually improve the runtime's knowledge of the stack types. See also #901 (comment)
…orts
This makes our logic more similar to that used by the dotnet runtime. This lets us infer correct stack types in edge cases such as #2401. It also improves support for obfuscated control flow such as #2878.
Input code
Binary:
KeyGenMe-SA2.zip
Method:
KeyGenMe.MainForm.btnVerify_Click
, Metadata token:0x0600000B
Erroneous output produced by ILSpy 8.0-preview3
This problem exists in ILSpy versions all the way back to 3.0, the pre-rewrite 2.4 engine decompiles this method successfully.
ILSpy 2.4 decompilation:
IL code for
btnVerify_Click
This is rather exotic IL code but it does execute without issues on the CLR.
This difference seems to come down to the approach used to build the initial ILAst model. The current decompiler processes instructions in the order in which they appear in the body. However, the older engine used a different approach as can be seen here:
https://github.com/icsharpcode/ILSpy/blob/v2.4/ICSharpCode.Decompiler/ILAst/ILAstBuilder.cs#L313
The older decompiler processes instructions in an order more reminiscent of that of the actual execution flow.
Details
The text was updated successfully, but these errors were encountered: