Net 11 Preview 1
Steps to Reproduce:
- dotnet new console
- Copy & paste program program below
- dotnet build
A minimal repro, with source-code provided, is ideal. Most compiler/language issues can be distilled into a snippet that can be pasted into .NET Lab.
Expected Behavior: Compiles
Actual Behavior: Compiler crash (NullReferenceException in Microsoft.CodeAnalysis.CSharp.AsyncMethodToStateMachineRewriter.VisitAwaitExpression)
using System;
Task.Run(async () =>
{
await Func();
[System.Runtime.CompilerServices.RuntimeAsyncMethodGeneration(true)]
static async Task Func()
{
await Task.Delay(1);
await Task.Yield();
}
});
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Method)]
internal class RuntimeAsyncMethodGenerationAttribute(bool runtimeAsync) : Attribute
{
public bool RuntimeAsync { get; } = runtimeAsync;
}
}
Encountered in dotnet/runtime#123727
Net 11 Preview 1
Steps to Reproduce:
A minimal repro, with source-code provided, is ideal. Most compiler/language issues can be distilled into a snippet that can be pasted into .NET Lab.
Expected Behavior: Compiles
Actual Behavior: Compiler crash (
NullReferenceExceptioninMicrosoft.CodeAnalysis.CSharp.AsyncMethodToStateMachineRewriter.VisitAwaitExpression)Encountered in dotnet/runtime#123727