Fix initialization of FakeProperty with setter #2792
Merged
siegfriedpammer merged 3 commits intoicsharpcode:masterfrom Nov 3, 2022
Merged
Fix initialization of FakeProperty with setter #2792siegfriedpammer merged 3 commits intoicsharpcode:masterfrom
siegfriedpammer merged 3 commits intoicsharpcode:masterfrom
Conversation
Member
You could create an IL-Pretty-Test like this one: https://github.com/icsharpcode/ILSpy/blob/master/ICSharpCode.Decompiler.Tests/TestCases/ILPretty/UnknownTypes.il ILAsm will happily assemble a file that contains references to unknown types/members. |
Seems like a typo - the setter method was assigned to the Getter property The test GuessAccessors needed adjustments in the generated code. ILSpy is more eager to merge property assignments
cdb428f to
44a6aa7
Compare
44a6aa7 to
93eecf9
Compare
Contributor
Author
|
I added a test case which I believe covers the changed code. I also needed to slightly change output of one the existing test. It does not change the meaning of the code, but it's now eager to merge assignments into |
Member
|
Thank you for your contribution! |
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.
ILSpy crashed with NullReferenceException when it couldn't resolve some dependency (Newtonsoft.Json in my case, the problem was around
JObject.Item[string]indexer)Seems like a typo when FakeProperty is initialized - the setter method was assigned to the Getter property
Solution
First commit contains the actual fix.
In the second commit I included some asserts and a ToString implementation I used to debug the problem. I'm guessing that more asserts would be welcome, but if you don't like it, just merge only the first commit.