If I'am selecting C# 4.0 it shows me the following code structure:
But when I'am selecting the C# 5.0 I see the following result:
All checkboxes in Option -> Decompiler is checked:
I'am expecting that it should be the same
The AsyncStateMachine
attribute is automatically generated by the C# compiler. When you re-compile the "C# 5" version of the decompiled code, the compiler will add back the "missing" attributes.
Thus, ILSpy either shows the "C# 4" low-level view (what async/await compiles to), or the "C# 5" high-level view (what the original source code was). It would be a weird mixture between the two if you could see all attributes, but with the original async/await in the method body.