I'm watching a video lesson, where the author talking about async/await under the hood. He shows prepared and decompiled code. I want to do the same from scratch. I mean, decompile some C# compiled file with the help of, from example, DotPeek. So I have the following simple example:
class Program
{
public static async Task KekAsync()
{
Console.WriteLine("Current thread id before await {0}", Thread.CurrentThread.ManagedThreadId);
await Task.Delay(200);
Console.WriteLine("Current thread id after await {0}", Thread.CurrentThread.ManagedThreadId);
await Task.Delay(200);
Console.WriteLine("Current thread id after await again {0}", Thread.CurrentThread.ManagedThreadId);
await Task.Delay(200);
Console.WriteLine("Current thread id after await again and again {0}", Thread.CurrentThread.ManagedThreadId);
}
static async Task Main(string[] args)
{
await KekAsync();
}
}
In the DotPeek settings I have the following:
But I don't see code generation result. I see async and await.
DotPeek just shows me my source code. But I would like to see implementation of Async state machine. Result of the code generation. I used .NET Core 3.1 and the last version of .NET Framework. Both give me the same result. Am I miss something?
So, the answer is simple. Right click on the file -> Decompiled Sources