Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #3031: emit sequence points for expression-bodied properties and indexers #3032

Merged

Conversation

KirillOsenkov
Copy link
Contributor

Need to visit properties and indexers in SequencePointBuilder to account for ExpressionBody.

Adds a failing test for all kinds of members. Currently failing with an unrelated duplicate sequence points for a local function body.

@siegfriedpammer
Copy link
Member

Thank you for the proposed fix. If I remember correctly, SequencePointBuilder should only handle statements and expressions, so everything inside a method, ctor, property, indexer, etc. The correct place to fix this would be DebugInfoGenerator which maps the generated sequence points to MethodDefinitions in the assembly. See my proposed fix in https://github.com/icsharpcode/ILSpy/tree/pdbgen-fixes...

There is one more nut I need to crack regarding local functions, but I might be able to get to that this week.

Note that we intentionally do not use expression-bodied members for single accessors, but only for getter-only properties/indexers. Also note that my branch mentioned above fixes another issue in the getter-only transform.

Thanks for creating a test case. I hope we'll be able to solve the PDB gen unit testing problem soon!

@siegfriedpammer
Copy link
Member

siegfriedpammer commented Jul 2, 2023

I think I will be basing the fix on the changes in my branch and use as much as possible from this PR. There is no need for you to invest any more time. However, I would very grateful, if you could take my final solution for a test ride. Thank you very much!

@siegfriedpammer
Copy link
Member

Thank you for the proposed fix. If I remember correctly, SequencePointBuilder should only handle statements and expressions, so everything inside a method, ctor, property, indexer, etc. The correct place to fix this would be DebugInfoGenerator which maps the generated sequence points to MethodDefinitions in the assembly. See my proposed fix in pdbgen-fixes...

I have to retract this previous statement: the changes to SequencePointBuilder are equally necessary. Sorry for the confusion on my end. :) It's been a long time since I touched that part of the decompiler...

@siegfriedpammer
Copy link
Member

@KirillOsenkov I have pushed my changes. I have cleaned up the PR a bit. Could you try and test the generated PDB on your end? It seems to work fine with VS 17.6.4. Thanks a lot!

@KirillOsenkov
Copy link
Contributor Author

Sorry, I should have clarified, I don't work on the Visual Studio debugger team and I am not using the pdb generation logic at all. I'm not using the DebugInfoGenerator for my purposes, I only use the SequencePointBuilder to get the raw sequence points. The changes in my PR are sufficient for my needs, however the VS debugger team is likely to need both your and my changes (I'm guessing).

@KirillOsenkov
Copy link
Contributor Author

Other than the potential duplicate ILFunction annotations in CopyAnnotationsFrom, it looks good as far as I can see. Thanks!

Copy link
Contributor Author

@KirillOsenkov KirillOsenkov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great as far as I can see. Thanks so much! 👍🏻

@siegfriedpammer siegfriedpammer merged commit 1100d64 into icsharpcode:master Jul 4, 2023
5 checks passed
@siegfriedpammer
Copy link
Member

Thank you for your help with this!

@KirillOsenkov KirillOsenkov deleted the dev/kirillo/sequencePoints branch July 4, 2023 05:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants