Skip to content

[wasm][debugger] Stepping out of an async method doesn't return to the call site #42421

@radical

Description

@radical

Failing test (not added to the repo yet):

        [Fact]
        public async Task StepOutOfAsyncMethod()
        {
            var insp = new Inspector();
            //Collect events
            var scripts = SubscribeToScripts(insp);

            await Ready();
            await insp.Ready(async (cli, token) =>
            {
                ctx = new DebugTestContext(cli, insp, token, scripts);
                string source_file = "dotnet://debugger-test.dll/debugger-async-step.cs";

                await SetBreakpointInMethod("debugger-test.dll", "DebuggerTests.AsyncStepClass", "TestAsyncStepOut2", 2);
                await EvaluateAndCheck(
                    "window.setTimeout(function() { invoke_static_method_async('[debugger-test] DebuggerTests.AsyncStepClass:TestAsyncStepOut'); }, 1);",
                    "dotnet://debugger-test.dll/debugger-async-step.cs", 21, 12,
                    "MoveNext");

                await StepAndCheck(StepKind.Out, source_file, 15, 4, "TestAsyncStepOut");
            });
        }

Stepping out, should pause at line 16 in the code below.

        public static async Task TestAsyncStepOut()
15:        {
16:            await TestAsyncStepOut2("foobar");
        }

        public static async Task<int> TestAsyncStepOut2(string some)
        {
            var resp = await client.GetAsync("http://localhost:9400/debugger-driver.html");
            Console.WriteLine($"resp: {resp}"); /// BP at this line

            return 10;
        }

@thaystg this test is on top of your #42299

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions