Skip to content

Crash in runtime-async compiler #77897

@agocke

Description

@agocke

Version: 4.14.0-3.25170.6

Top of the stack:

error : Process terminated. System.InvalidOperationException: Unexpected value 'AwaitExpression' of type 'Microsoft.CodeAnalysis.CSharp.BoundKind' [/home/andy/code/runtimelab/src/tests/async/fibonacci-with-yields.csproj]
error :    at Microsoft.CodeAnalysis.CSharp.CodeGen.CodeGenerator.EmitExpressionCore(BoundExpression expression, Boolean used) [/home/andy/code/runtimelab/src/tests/async/fibonacci-with-yields.csproj]
error :    at Microsoft.CodeAnalysis.CSharp.CodeGen.CodeGenerator.EmitExpressionCoreWithStackGuard(BoundExpression expression, Boolean used) [/home/andy/code/runtimelab/src/tests/async/fibonacci-with-yields.csproj]
error :    at Microsoft.CodeAnalysis.CSharp.CodeGen.CodeGenerator.EmitExpression(BoundExpression expression, Boolean used) [/home/andy/code/runtimelab/src/tests/async/fibonacci-with-yields.csproj]
error :    at Microsoft.CodeAnalysis.CSharp.CodeGen.CodeGenerator.EmitStatement(BoundStatement statement) [/home/andy/code/runtimelab/src/tests/async/fibonacci-with-yields.csproj]
error :    at Microsoft.CodeAnalysis.CSharp.CodeGen.CodeGenerator.EmitStatementAndCountInstructions(BoundStatement statement) [/home/andy/code/runtimelab/src/tests/async/fibonacci-with-yields.csproj]
error :    at Microsoft.CodeAnalysis.CSharp.CodeGen.CodeGenerator.EmitSequencePointStatement(BoundSequencePoint node) [/home/andy/code/runtimelab/src/tests/async/fibonacci-with-yields.csproj]

Source code:

    [RuntimeAsyncMethodGeneration(true)]
    static async Task<int> Fib(int i)
    {
        if (i <= 1)
        {
            if (doYields)
            {
                await Task.Yield();
            }

            return 1;
        }

        int i1 = await Fib(i - 1);
        int i2 = await Fib(i - 2);

        return i1 + i2;
    }

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions