Conversation
Member
|
Yes, it needs two separate assemblies. |
Member
|
I think you could maybe test this with a This would have to be a pretty-test, as it would not be possible to recompile the decompiled code. |
Member
|
Thank you very much for your contribution! |
Contributor
Author
|
Thanks so much for providing the test case and merging! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
ILSpy could match an instance method call with a static method reference. This can happen when resolving a method whose current definition is
staticbut the IL actually calls an instance method. I.e. the method was originally an instance method but was changed tostatic.This results in the decompiled code to silently drop the instance argument on the evaluation stack. While this produces valid/compilible C# code, it does not accurately decompile the given code.
Example:
the reference code was changed from
to
the original code is
but gets wrongly decompiled to
Solution
Refmethod, so ILSpy decompiles the code without a reference and producesA.instance.Ref()