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

EnC calculates line deltas incorrectly #53263

Closed
tmat opened this issue May 7, 2021 · 0 comments · Fixed by #53735
Closed

EnC calculates line deltas incorrectly #53263

tmat opened this issue May 7, 2021 · 0 comments · Fixed by #53735

Comments

@tmat
Copy link
Member

tmat commented May 7, 2021

Version Used:
Version 16.10.0 Preview 3.0 [31303.14.main]

Steps to Reproduce:

Change

class C
{
    static int X() => 1;

    static int Y() => 1;
}

to

class C
{

    static int X() => 1;
    static int Y() => 1;
                            ////
}

image

Sequence point updates is a list of (oldLine, newLine), ordered by oldLine.
Each entry in the list applies the delta to the oldLine and all lines greater than oldLine that are less then next entry's oldLine.
Roslyn sees that X moved by one line so it produces line delta +1 for the start line of X. but then it does not compensate for Y not moving. It would need to add line delta 0 to the last line of X + 1

It might be better to change the debugger interface to accept list of (oldStartLine, oldEndLine, delta). this would mean that delta is applied on all lines in range [oldStartLine, oldEndLine). For now we can update Roslyn to produce equivalent: (oldStartLine, oldStartLine + delta), (oldEndLine, oldEndLine) - the second entry resets the delta and would only be present if there is no other delta available for that line.

Another issue is with overlapping lines:

Start with

class Program
{
    static void Main()
    {
        var p = new Program();
        var x = p.P;
        p.P = 1;
    }

    static int F() => 1;

    int P { get => F(); set => F(); }
}

and change it to:

class Program
{
    static void Main()
    {
        var p = new Program();
        var x = p.P;
        p.P = 1;
    }

    static int F() => 1;

    int P { get => 
                   F(); set => 
                               F(); }
}

Step thru the getter/setter - the debugger mapped both getter and setter to the setter.
image

@dotnet-issue-labeler dotnet-issue-labeler bot added Area-Interactive untriaged Issues and PRs which have not yet been triaged by a lead labels May 7, 2021
@tmat tmat self-assigned this May 7, 2021
@tmat tmat added this to the 17.0.P2 milestone May 7, 2021
@jinujoseph jinujoseph added Bug and removed untriaged Issues and PRs which have not yet been triaged by a lead labels May 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants