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 7456, 3704, 12019 (debug scopes, self arg, incorrect information display on shadowing) #12018

Merged
merged 14 commits into from
Aug 25, 2021

Conversation

dsyme
Copy link
Contributor

@dsyme dsyme commented Aug 23, 2021

  1. VS2019 had a regression where not all method local scopes were being emitted to the PDB Variables do not show in debugger in top-level program #7456

  2. Self/this is not known in debugging (unless called "this") #12019

  3. We've long had a problem with shadowed bindings Debugger info is incorrect for shadowed bindings #3704. This fixes this by

    • duplicating out method local scopes where shadowing is happening as necessary
    • add the text " (shadowed)" to the name associated with a shadowed local for each nested scope where it is shadowed

    There is no change to IL, just the PDB

  4. Fix Out-of-scope locals are shown uninitialized in debugger when debugging top-level module code #12029

An example is shown below. Note the variable name in the locals window, and not that the hover-tip now gives the correct result.

Fix for #1 demonstrated:

image

Fix for #2 demonstrated:

image

Fix for #3 demonstrated:

image

Fix for #4 demonstrated:

image

@dsyme dsyme changed the title Fix 7456, 3704 (debug scopes and incorrect information display on shadowing) Fix 7456, 3704, 12019 (debug scopes, self arg, incorrect information display on shadowing) Aug 23, 2021
@dsyme
Copy link
Contributor Author

dsyme commented Aug 24, 2021

I'll add a bit more technical detail about how the removal of shadowing works

First, assume the IL Debug Scopes actually form a well-formed tree, and there is an IL instruction range from 0 to 9, with these scopes with the indicated locals defined

0--------9   // A,D defined
    4----9   // B,C defined
    4-6   // C,D defined

The idea is to split and rename to these non-nested scopes with the indicated variable mappings

0--------9   // nothing defined (root scope)
0--3         // A,D defined
       7-9   // A, B, C, D defined
    4-6   // A, B, C, D, C (shadowed),D (shadowed) defined

There is no intrinsic need to have nested scopes - splitting them is ok as long as we have a root scope.

@dsyme
Copy link
Contributor Author

dsyme commented Aug 24, 2021

I added a fix for #12029 to this PR

@dsyme dsyme merged commit 99b296b into dotnet:main Aug 25, 2021
@dsyme dsyme added the Theme-Simple-F# A cross-community initiative called "Simple F#", keeping people in the sweet spot of the language. label Aug 31, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Theme-Simple-F# A cross-community initiative called "Simple F#", keeping people in the sweet spot of the language.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Out-of-scope locals are shown uninitialized in debugger when debugging top-level module code
2 participants