See Also: AsyncStateMachineAttribute Members
You shouldn't apply the AsyncStateMachine attribute to methods in your code. For methods that have the async modifier, the compiler will apply the AsyncStateMachine attribute in the IL that the compiler emits.
When a method (MethodName) has the Async or async modifier, the compiler emits IL that includes a state machine structure. This structure contains the code in the method. That IL also contains a stub method (MethodName) that calls into the state machine. The compiler adds the AsyncStateMachine attribute to the stub method so that tools can identify the corresponding state machine. Details of the emitted IL might change in future releases of the compilers.
For information about the Async feature, see Asynchronous Programming with Async and Await (C# and Visual Basic).