Skip to content

Debugger fails on async lambda function #34192

@vsfeedback

Description

@vsfeedback

Using .net core 2.2 c# ver 7.3 debugger fails on async lambda function (returning task) passed as parameter to another function.

The code works as expected but debugging experience is broken. Only breakpoint present after first await keyword is honored. Sometimes debugger passes several times over calling function. This can be reproduced by a trivial sample application (see bellow).

using System;
using System.Threading.Tasks;

internal class Program
{
    private static async Task Main(string[] args)
    {
        // Call Method1
        await CallAsyncFunction(async () =>
        {
            // Place a break point on this row
            Console.WriteLine("A");
            // Place a break point on this row 
            await Task.Delay(100);
            // Place a break point on this row 
            Console.WriteLine("B");
            await Task.Delay(100);
            Console.WriteLine("C");
        });

        Console.ReadLine();
    }

    private static async Task CallAsyncFunction(Func<Task> func)
    {
        await func();
    }
}

This issue has been moved from https://developercommunity.visualstudio.com/content/problem/489653/debugger-fails-on-async-lambda-function.html
VSTS ticketId: 820585

These are the original issue comments:

Visual Studio Feedback System on 3/14/2019, 11:12 PM (20 hours ago):

We have directed your feedback to the appropriate engineering team for further evaluation. The team will review the feedback and notify you about the next steps.

These are the original issue solutions:
(no solutions)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area-InteractiveBugDeveloper CommunityThe issue was originally reported on https://developercommunity.visualstudio.comInteractive-DebugginguntriagedIssues and PRs which have not yet been triaged by a lead

    Type

    No type

    Projects

    Status

    Active/Investigating

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions