Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/compilers/CSharp/Runtime Async Design.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ namespace System.Runtime.CompilerServices;

public enum MethodImplOptions
{
Async = 1024
Async = 0x2000
}
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1762,7 +1762,7 @@ internal override System.Reflection.MethodImplAttributes ImplementationAttribute
// PROTOTYPE: Use real value from MethodImplAttributes when available
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could do this now, I think. That is, look in the ref assembly for MethodImplAttributes.Async, then write that value in.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't do anything like that today. We'll just wait for the MethodImplAttributes that we consume to update.

// When a method is emitted using runtime async, we add MethodImplAttributes.Async to indicate to the
// runtime to generate the state machine
result |= (System.Reflection.MethodImplAttributes)1024;
result |= (System.Reflection.MethodImplAttributes)0x2000;
}

return result;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ namespace Microsoft.CodeAnalysis.CSharp.UnitTests.CodeGen
public class CodeGenAsyncTests : EmitMetadataTestBase
{
// PROTOTYPE: Use the real value when possible
private const MethodImplAttributes MethodImplOptionsAsync = (MethodImplAttributes)1024;
private const MethodImplAttributes MethodImplOptionsAsync = (MethodImplAttributes)0x2000;
private static CSharpParseOptions WithRuntimeAsync(CSharpParseOptions options) => options.WithFeature("runtime-async", "on");

internal static string ExpectedOutput(string output, bool isRuntimeAsync = false)
Expand Down