Skip to content

EnC: stack corruption when editing recursive function #9653

Closed
@tmat

Description

@tmat

Version:

CoreCLR 2.1.0 and Desktop CLR 4.7.1

Steps to Reproduce:

using System;

class Program
{
    static void Main()
    {
        FuncTest(30);
    }

    static int FuncTest(int i)
    {
        Console.WriteLine(i);

        int j = 100; // conditional BP: "i == 20"
        j++;
        // j++;
        if (i == 1)
        {
            return 10;
        }
        else
        {
            return FuncTest(i - 1);
        }
    }
}     
  1. In the above code place conditional BP as indicated.
  2. F5
  3. When the BP is hit, uncomment // j++;
  4. Step (F11) until Console.WriteLine(i) is reached and then step over (F10).
  5. Observe the output.

Expected Behavior:

30
29
28
27
26
25
24
23
22
21
20
19

Actual Behavior:

30
29
28
27
26
25
24
23
22
21
20
32765

Notes

The IP is remapped once from IL offset 8 to 8.

IL delta:
image

Copied from dotnet/roslyn#24622

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions