From 87b5e636fcc06b9f5c129a255fa78786210c4177 Mon Sep 17 00:00:00 2001 From: Austin Wise Date: Sat, 26 Apr 2025 16:31:37 -0700 Subject: [PATCH] Csharp language reference attributes: add missing AsyncMethodBuilder SetStateMachine member This method is mentioned in the Roslyn documentation: https://github.com/dotnet/roslyn/blob/main/docs/features/task-types.md If it is not included when implementing the AsyncMethodBuilder pattern, the C# compiler fails to compile with a CS0656 error. I also added a `public` to the `Start` method to match the other methods described in this section. --- docs/csharp/language-reference/attributes/general.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/docs/csharp/language-reference/attributes/general.md b/docs/csharp/language-reference/attributes/general.md index 00c1a14c18e36..49d1d2a2228dc 100644 --- a/docs/csharp/language-reference/attributes/general.md +++ b/docs/csharp/language-reference/attributes/general.md @@ -147,10 +147,16 @@ The constructor to the `AsyncMethodBuilder` attribute specifies the type of the * A `Start` method with the following API signature: ```csharp - void Start(ref TStateMachine stateMachine) + public void Start(ref TStateMachine stateMachine) where TStateMachine : System.Runtime.CompilerServices.IAsyncStateMachine ``` +* A `SetStateMachine` method with the following API signature: + + ```csharp + public void SetStateMachine(System.Runtime.CompilerServices.IAsyncStateMachine stateMachine) + ``` + * An `AwaitOnCompleted` method with the following signature: ```csharp