如何在DotPeek的帮助下看到异步状态机(后台异步/等待)? [英] How I can see the Async state machine (async/await under the hood) with the help of DotPeek?
问题描述
我正在观看视频课程,作者在后台谈论异步/等待.他显示了准备好的和反编译的代码.我想从头开始做同样的事情.我的意思是,借助DotPeek的示例,反编译一些C#编译文件.因此,我有以下简单示例:
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();
}
}
在DotPeek设置中,我具有以下内容:
In the DotPeek settings I have the following:
但是我看不到代码生成结果.我看到异步并等待.
But I don't see code generation result. I see async and await.
DotPeek仅显示我的源代码.但是我想看看异步状态机的实现.代码生成的结果.我使用了.NET Core 3.1和.NET Framework的最新版本.两者都给我相同的结果.我想念什么吗?
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
这篇关于如何在DotPeek的帮助下看到异步状态机(后台异步/等待)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!