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

Debugger. Stepping over await for async methods. #778

Open
rusanov-vladimir opened this Issue Sep 20, 2016 · 0 comments

Comments

Projects
None yet
1 participant
@rusanov-vladimir

rusanov-vladimir commented Sep 20, 2016

Consider this program:

using System;
using System.Threading.Tasks;

class C
{
    public static void Main() {

        var instance = new Instance(); 
        instance.Start().Wait();
    }
}
class Instance
{
    public static async Task F() { for(var i=0; i<100; i++) { Console.WriteLine(i); await Task.Delay(10); } }
    public async Task Start() {
       var a = 1;
       await F();//<---------Breakpoint
       var z = 2;
       var x = 3;
    }
}

If I place breakpoint at line await F(); and when it hit I click on StepOver execution passes to instance.Start().Wait();. That is caused by side effects of method rewriting that compiler does under the hood. Is it possible to have more userfriendly experience and to continue on var z = 2; instead?

To achieve this I've been looking at ISymUnmanagedAsyncMethod::GetAsyncStepInfo, This method returns an await's return instruction, identifying a potential yield, and breakpointMethod/breakpointOffset pair that tells us where the asynchronous operation will resume. Yet, I cannot get my head around how to integrate it in project.

Any thoughts on this?

StepOver

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment