Skip to content

Commit ea56e90

Browse files
authored
Csharp language reference attributes: add missing AsyncMethodBuilder SetStateMachine member (#45929)
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.
1 parent 6753af2 commit ea56e90

File tree

1 file changed

+7
-1
lines changed
  • docs/csharp/language-reference/attributes

1 file changed

+7
-1
lines changed

docs/csharp/language-reference/attributes/general.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,10 +147,16 @@ The constructor to the `AsyncMethodBuilder` attribute specifies the type of the
147147
* A `Start` method with the following API signature:
148148

149149
```csharp
150-
void Start<TStateMachine>(ref TStateMachine stateMachine)
150+
public void Start<TStateMachine>(ref TStateMachine stateMachine)
151151
where TStateMachine : System.Runtime.CompilerServices.IAsyncStateMachine
152152
```
153153

154+
* A `SetStateMachine` method with the following API signature:
155+
156+
```csharp
157+
public void SetStateMachine(System.Runtime.CompilerServices.IAsyncStateMachine stateMachine)
158+
```
159+
154160
* An `AwaitOnCompleted` method with the following signature:
155161

156162
```csharp

0 commit comments

Comments
 (0)