简体   繁体   English

DotPeek:看不到编译器生成的代码

[英]DotPeek: cannot see compiler-generated code

  1. I have my library with one file that contains:我的图书馆有一个文件,其中包含:
public class SomeClassWithAwait
{
    public async Task<int> MethodAsync()
    {
        return await Task.Run(() => 1 + 1);
    }
} 
  1. I turn on the feature "Show compiler-generated Code".我打开“显示编译器生成的代码”功能。
  2. I see changes in "Assembly Explorer", for example - state machine for await.我在“Assembly Explorer”中看到了变化,例如 - state 机器等待。 But I cannot see changes in the file.但是我看不到文件中的更改。 I see only async\await as before when I turn on feature from step 2.当我从第 2 步打开功能时,我像以前一样只看到 async\await。

What I tried: close\open file, close\open dotPeek, rebuild library in release\debug mode.我尝试了什么:关闭\打开文件,关闭\打开 dotPeek,在发布\调试模式下重建库。

Version dotPeek: 2020.2.2 build on 2020-09-09 (latest for today).版本 dotPeek:2020.2.2 构建于 2020-09-09(今天最新)。

Any ideas?有任何想法吗?


UPDATED更新

About "Use sources from symbol files when available" feature: Still doesn't work for me, I got this:关于“在可用时使用符号文件中的源”功能:仍然对我不起作用,我得到了这个:

public async Task<int> MethodAsync()
{
  int num = await Task.Run<int>((Func<int>) (() => 2));
  return num;
}

So, I still have async/await.所以,我仍然有异步/等待。

Uncheck "Use sources from symbol files when available".取消选中“在可用时使用来自符号文件的源”。 Then close the window with the code and reopen it.然后用代码关闭window再重新打开。

使用符号文件中的源

Try to open the decompiled source: Right click on a class -> Decompiled Sources尝试打开反编译源:右击一个class -> Decompiled Sources

dotPeek will show the await/async state machine instead of the "async/await" statements. dotPeek 将显示 await/async state 机器,而不是“async/await”语句。

dotPeek Screenshot dotPeek 截图

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 了解dotPeek反编译代码中编译器生成的类型 - Understanding compiler-generated type in dotPeek decompiled code “使用”块编译器生成的代码在dotPeek或ILSpy中不可见 - 'using' block compiler generated code not visible in dotPeek or ILSpy 在编译器生成的表达式树中使用Expression - Using an Expression in a compiler-generated expression tree 为什么编译器为“ yield”生成的枚举数不是结构? - Why is the compiler-generated enumerator for “yield” not a struct? 这个编译器生成的枚举器是什么意思? - What does this compiler-generated enumerator mean? 对象到字典,编译器生成的函数 - Object-To-Dictionary, compiler-generated function 为什么编译器生成的 state 机器反复将 state 恢复为 -1? - Why the compiler-generated state machine restores repeatedly the state to -1? 如何从.NET中的用户类distingush编译器生成的类 - How to distingush compiler-generated classes from user classes in .NET 使用“yield”时,为什么编译器生成的类型同时实现IEnumerable和IEnumerator - When using “yield” why does compiler-generated type implement both IEnumerable and IEnumerator Visual Studio调试器-通过调试器访问编译器生成的临时变量的任何方法? - Visual Studio Debugger - any way to access compiler-generated temporary variables through the debugger?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM