Debugging Async methods not working
See original GitHub issueI install MrAdvice in my project and I have this code which I have no problem in debugging :
class Program
{
static void Main()
{
Async().GetAwaiter().GetResult();
Non_Async();
}
static async Task Async()
{
var foo = "bar";
// can see foo in debug
}
static void Non_Async()
{
var foo = "bar";
// can see foo in debug
}
}
when I add an Advice class to my code, I can no longer see local variables in async methods in debug mode.
class Program
{
static void Main()
{
Async().GetAwaiter().GetResult();
Non_Async();
}
static async Task Async()
{
var foo = "bar";
// can NOT see foo in debug
}
static void Non_Async()
{
var foo = "bar";
// can see foo in debug
}
}
class AdviceA : Attribute, IMethodAdvice
{
public void Advise(MethodAdviceContext context)
{
Console.WriteLine("Entry From Advice A");
context.Proceed();
Console.WriteLine("Exit From Advice A");
}
}
Issue Analytics
- State:
- Created 7 years ago
- Comments:16 (7 by maintainers)
Top Results From Across the Web
Why can't I debug code in an async method?
Because you are not await ing your GetDataAsync method. When the first await is reached the thread is returned to the caller.
Read more >How Do I Debug Async Code in Visual Studio?
You can access the Tasks window at Debug > Windows > Task or by using CTRL+SHIFT+D, K. Tasks window. How can I locate...
Read more >Debug Async Code
In this article, you will learn how to debug async code. ... integrated with Visual Studio, we can debug the code and solve...
Read more >Debugger can't step into async function which returns ...
I'm finding sometimes the debugger (VS 2019) steps into await calls as expected, and sometimes it steps into disassembly of the async support ......
Read more >Debugger cannot step over "await" when using custom task ...
I just want to add that when I run the code in a new CLI project with just an "async Task Main()" the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@picrap thanks, really appreciate it.
The async debug was solved in dnlib, so MrAdvice 2.5.3 uses it and solves the problem too.