1
  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. But I cannot see changes in the file. I see only async\await as before when I turn on feature from step 2.

What I tried: close\open file, close\open dotPeek, rebuild library in release\debug mode.

Version dotPeek: 2020.2.2 build on 2020-09-09 (latest for today).

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.

Sergey
  • 166
  • 5

2 Answers2

0

Uncheck "Use sources from symbol files when available". Then close the window with the code and reopen it.

Use sources from symbol files

Thomas Weller
  • 55,411
  • 20
  • 125
  • 222
  • Thanks for the answer but it still doesn't work for me. Code changed but async\await is still here. Updated my question with details. – Sergey Apr 07 '22 at 09:43
0

Try to open the decompiled source: Right click on a class -> Decompiled Sources

dotPeek will show the await/async state machine instead of the "async/await" statements.

dotPeek Screenshot

See also the official documentation: https://www.jetbrains.com/help/decompiler/Navigation_and_Search__Navigate_from_Here__Decompiled_Code.html

Community
  • 1
  • 1
igiona
  • 31
  • 4
  • 1
    Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – MD. RAKIB HASAN Jan 31 '23 at 07:16