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

Removing local variable from method body does not remove it from debug info #674

Closed
vitek-karas opened this issue Jun 16, 2020 · 0 comments · Fixed by #676
Closed

Removing local variable from method body does not remove it from debug info #674

vitek-karas opened this issue Jun 16, 2020 · 0 comments · Fixed by #676

Comments

@vitek-karas
Copy link
Contributor

Editing method body by removing one of the local variables does not update the attached debug information by removing debug info for the local variable. When saved the PDB still has the local variable information in it and some tools get confused (for example PDB2PDB writes out a warning).

I think the correct way to handle this would be to add logic into VariableDefinitionCollection.OnRemove to also remove the variable from the debug info (if it's there) by its index.

I don't think there's anything to do in OnAdd as adding VariableDefinition doesn't carry any information which should be preserved in the debug info (like the name of the variable). So not adding a debug info for the new variable seems to be OK.

Originally found in dotnet/linker#1260.

I plan to work on the PR for this unless somebody wants to pick it up first.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant