Closed lucasmeijer closed 1 month ago
IEnumerable<A> B() { yield break; } ref struct A;
If i compile this with .net 9.0.100-rc.2.24474.11 on my arm64 mac, roslyn exits with an unhandled exception:
0>Microsoft.CSharp.Core.targets(89,5): Error : Process terminated. System.InvalidOperationException: Unexpected value 'NoConversion' of type 'Microsoft.CodeAnalysis.CSharp.ConversionKind' 0>Microsoft.CSharp.Core.targets(89,5): Error : at Microsoft.CodeAnalysis.CSharp.CodeGen.CodeGenerator.EmitConversion(BoundConversion conversion) 0>Microsoft.CSharp.Core.targets(89,5): Error : at Microsoft.CodeAnalysis.CSharp.CodeGen.CodeGenerator.EmitConversionExpression(BoundConversion conversion, Boolean used) 0>Microsoft.CSharp.Core.targets(89,5): Error : at Microsoft.CodeAnalysis.CSharp.CodeGen.CodeGenerator.EmitExpressionCoreWithStackGuard(BoundExpression expression, Boolean used) 0>Microsoft.CSharp.Core.targets(89,5): Error : at Microsoft.CodeAnalysis.CSharp.CodeGen.CodeGenerator.EmitExpression(BoundExpression expression, Boolean used) 0>Microsoft.CSharp.Core.targets(89,5): Error : at Microsoft.CodeAnalysis.CSharp.CodeGen.CodeGenerator.EmitReturnStatement(BoundReturnStatement boundReturnStatement) 0>Microsoft.CSharp.Core.targets(89,5): Error : at Microsoft.CodeAnalysis.CSharp.CodeGen.CodeGenerator.EmitStatement(BoundStatement statement) 0>Microsoft.CSharp.Core.targets(89,5): Error : at Microsoft.CodeAnalysis.CSharp.CodeGen.CodeGenerator.EmitStatements(ImmutableArray`1 statements) 0>Microsoft.CSharp.Core.targets(89,5): Error : at Microsoft.CodeAnalysis.CSharp.CodeGen.CodeGenerator.EmitUninstrumentedBlock(BoundBlock block) 0>Microsoft.CSharp.Core.targets(89,5): Error : at Microsoft.CodeAnalysis.CSharp.CodeGen.CodeGenerator.EmitStatement(BoundStatement statement) 0>Microsoft.CSharp.Core.targets(89,5): Error : at Microsoft.CodeAnalysis.CSharp.CodeGen.CodeGenerator.GenerateImpl() 0>Microsoft.CSharp.Core.targets(89,5): Error : at Microsoft.CodeAnalysis.CSharp.MethodCompiler.GenerateMethodBody(PEModuleBuilder moduleBuilder, MethodSymbol method, Int32 methodOrdinal, BoundStatement block, ImmutableArray`1 lambdaDebugInfo, ImmutableArray`1 orderedLambdaRuntimeRudeEdits, ImmutableArray`1 closureDebugInfo, ImmutableArray`1 stateMachineStateDebugInfos, StateMachineTypeSymbol stateMachineTypeOpt, VariableSlotAllocator variableSlotAllocatorOpt, BindingDiagnosticBag diagnostics, DebugDocumentProvider debugDocumentProvider, ImportChain importChainOpt, Boolean emittingPdb, ImmutableArray`1 codeCoverageSpans, AsyncForwardEntryPoint entryPointOpt) 0>Microsoft.CSharp.Core.targets(89,5): Error : at Microsoft.CodeAnalysis.CSharp.MethodCompiler.CompileSynthesizedMethods(TypeCompilationState compilationState) 0>Microsoft.CSharp.Core.targets(89,5): Error : at Microsoft.CodeAnalysis.CSharp.MethodCompiler.CompileNamedType(NamedTypeSymbol containingType) 0>Microsoft.CSharp.Core.targets(89,5): Error : at Microsoft.CodeAnalysis.CSharp.MethodCompiler.<>c__DisplayClass25_0.<CompileNamedTypeAsync>b__0() 0>Microsoft.CSharp.Core.targets(89,5): Error : at System.Environment.FailFast(System.Runtime.CompilerServices.StackCrawlMarkHandle, System.String, System.Runtime.CompilerServices.ObjectHandleOnStack, System.String) 0>Microsoft.CSharp.Core.targets(89,5): Error : at System.Environment.FailFast(System.Threading.StackCrawlMark ByRef, System.String, System.Exception, System.String) 0>Microsoft.CSharp.Core.targets(89,5): Error : at System.Environment.FailFast(System.String, System.Exception) 0>Microsoft.CSharp.Core.targets(89,5): Error : at Microsoft.CodeAnalysis.FailFast.OnFatalException(System.Exception) 0>Microsoft.CSharp.Core.targets(89,5): Error : at Microsoft.CodeAnalysis.ErrorReporting.FatalError.Report(System.Exception, Microsoft.CodeAnalysis.ErrorReporting.ErrorSeverity, Boolean) 0>Microsoft.CSharp.Core.targets(89,5): Error : at Microsoft.CodeAnalysis.ErrorReporting.FatalError.ReportAndPropagateUnlessCanceled(System.Exception, Microsoft.CodeAnalysis.ErrorReporting.ErrorSeverity) 0>Microsoft.CSharp.Core.targets(89,5): Error : at Microsoft.CodeAnalysis.CSharp.MethodCompiler+<>c__DisplayClass25_0.<CompileNamedTypeAsync>b__0() 0>Microsoft.CSharp.Core.targets(89,5): Error : at System.Runtime.EH.FindFirstPassHandler(System.Object, UInt32, System.Runtime.StackFrameIterator ByRef, UInt32 ByRef, Byte* ByRef) 0>Microsoft.CSharp.Core.targets(89,5): Error : at System.Runtime.EH.DispatchEx(System.Runtime.StackFrameIterator ByRef, ExInfo ByRef) 0>Microsoft.CSharp.Core.targets(89,5): Error : at System.Runtime.EH.RhThrowEx(System.Object, ExInfo ByRef) 0>Microsoft.CSharp.Core.targets(89,5): Error : at Microsoft.CodeAnalysis.CSharp.CodeGen.CodeGenerator.EmitConversion(Microsoft.CodeAnalysis.CSharp.BoundConversion) 0>Microsoft.CSharp.Core.targets(89,5): Error : at Microsoft.CodeAnalysis.CSharp.CodeGen.CodeGenerator.EmitConversionExpression(Microsoft.CodeAnalysis.CSharp.BoundConversion, Boolean) 0>Microsoft.CSharp.Core.targets(89,5): Error : at Microsoft.CodeAnalysis.CSharp.CodeGen.CodeGenerator.EmitExpressionCoreWithStackGuard(Microsoft.CodeAnalysis.CSharp.BoundExpression, Boolean) 0>Microsoft.CSharp.Core.targets(89,5): Error : at Microsoft.CodeAnalysis.CSharp.CodeGen.CodeGenerator.EmitExpression(Microsoft.CodeAnalysis.CSharp.BoundExpression, Boolean) 0>Microsoft.CSharp.Core.targets(89,5): Error : at Microsoft.CodeAnalysis.CSharp.CodeGen.CodeGenerator.EmitReturnStatement(Microsoft.CodeAnalysis.CSharp.BoundReturnStatement) 0>Microsoft.CSharp.Core.targets(89,5): Error : at Microsoft.CodeAnalysis.CSharp.CodeGen.CodeGenerator.EmitStatement(Microsoft.CodeAnalysis.CSharp.BoundStatement) 0>Microsoft.CSharp.Core.targets(89,5): Error : at Microsoft.CodeAnalysis.CSharp.CodeGen.CodeGenerator.EmitStatements(System.Collections.Immutable.ImmutableArray`1<Microsoft.CodeAnalysis.CSharp.BoundStatement>) 0>Microsoft.CSharp.Core.targets(89,5): Error : at Microsoft.CodeAnalysis.CSharp.CodeGen.CodeGenerator.EmitUninstrumentedBlock(Microsoft.CodeAnalysis.CSharp.BoundBlock) 0>Microsoft.CSharp.Core.targets(89,5): Error : at Microsoft.CodeAnalysis.CSharp.CodeGen.CodeGenerator.EmitStatement(Microsoft.CodeAnalysis.CSharp.BoundStatement) 0>Microsoft.CSharp.Core.targets(89,5): Error : at Microsoft.CodeAnalysis.CSharp.CodeGen.CodeGenerator.GenerateImpl() 0>Microsoft.CSharp.Core.targets(89,5): Error : at Microsoft.CodeAnalysis.CSharp.MethodCompiler.GenerateMethodBody(Microsoft.CodeAnalysis.CSharp.Emit.PEModuleBuilder, Microsoft.CodeAnalysis.CSharp.Symbols.MethodSymbol, Int32, Microsoft.CodeAnalysis.CSharp.BoundStatement, System.Collections.Immutable.ImmutableArray`1<Microsoft.CodeAnalysis.Emit.EncLambdaInfo>, System.Collections.Immutable.ImmutableArray`1<Microsoft.CodeAnalysis.CodeGen.LambdaRuntimeRudeEditInfo>, System.Collections.Immutable.ImmutableArray`1<Microsoft.CodeAnalysis.Emit.EncClosureInfo>, System.Collections.Immutable.ImmutableArray`1<Microsoft.CodeAnalysis.CodeGen.StateMachineStateDebugInfo>, Microsoft.CodeAnalysis.CSharp.StateMachineTypeSymbol, Microsoft.CodeAnalysis.CodeGen.VariableSlotAllocator, Microsoft.CodeAnalysis.CSharp.BindingDiagnosticBag, Microsoft.CodeAnalysis.CodeGen.DebugDocumentProvider, Microsoft.CodeAnalysis.CSharp.ImportChain, Boolean, System.Collections.Immutable.ImmutableArray`1<Microsoft.CodeAnalysis.CodeGen.SourceSpan>, AsyncForwardEntryPoint) 0>Microsoft.CSharp.Core.targets(89,5): Error : at Microsoft.CodeAnalysis.CSharp.MethodCompiler.CompileSynthesizedMethods(Microsoft.CodeAnalysis.CSharp.TypeCompilationState) 0>Microsoft.CSharp.Core.targets(89,5): Error : at Microsoft.CodeAnalysis.CSharp.MethodCompiler.CompileNamedType(Microsoft.CodeAnalysis.CSharp.Symbols.NamedTypeSymbol) 0>Microsoft.CSharp.Core.targets(89,5): Error : at Microsoft.CodeAnalysis.CSharp.MethodCompiler+<>c__DisplayClass25_0.<CompileNamedTypeAsync>b__0() 0>Microsoft.CSharp.Core.targets(89,5): Error : at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(System.Threading.Thread, System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object) 0>Microsoft.CSharp.Core.targets(89,5): Error : at System.Threading.Tasks.Task.ExecuteWithThreadLocal(System.Threading.Tasks.Task ByRef, System.Threading.Thread) 0>Microsoft.CSharp.Core.targets(89,5): Error : at System.Threading.ThreadPoolWorkQueue.Dispatch() 0>Microsoft.CSharp.Core.targets(89,5): Error : at System.Threading.PortableThreadPool+WorkerThread.WorkerThreadStart() 0>Microsoft.CSharp.Core.targets(89,5): Error : at System.Threading.Thread.StartCallback() 0>Microsoft.CSharp.Core.targets(89,5): Error : System.InvalidOperationException: Unexpected value 'NoConversion' of type 'Microsoft.CodeAnalysis.CSharp.ConversionKind' 0>Microsoft.CSharp.Core.targets(89,5): Error : at Microsoft.CodeAnalysis.CSharp.CodeGen.CodeGenerator.EmitConversion(BoundConversion conversion) 0>Microsoft.CSharp.Core.targets(89,5): Error : at Microsoft.CodeAnalysis.CSharp.CodeGen.CodeGenerator.EmitConversionExpression(BoundConversion conversion, Boolean used) 0>Microsoft.CSharp.Core.targets(89,5): Error : at Microsoft.CodeAnalysis.CSharp.CodeGen.CodeGenerator.EmitExpressionCoreWithStackGuard(BoundExpression expression, Boolean used) 0>Microsoft.CSharp.Core.targets(89,5): Error : at Microsoft.CodeAnalysis.CSharp.CodeGen.CodeGenerator.EmitExpression(BoundExpression expression, Boolean used) 0>Microsoft.CSharp.Core.targets(89,5): Error : at Microsoft.CodeAnalysis.CSharp.CodeGen.CodeGenerator.EmitReturnStatement(BoundReturnStatement boundReturnStatement) 0>Microsoft.CSharp.Core.targets(89,5): Error : at Microsoft.CodeAnalysis.CSharp.CodeGen.CodeGenerator.EmitStatement(BoundStatement statement) 0>Microsoft.CSharp.Core.targets(89,5): Error : at Microsoft.CodeAnalysis.CSharp.CodeGen.CodeGenerator.EmitStatements(ImmutableArray`1 statements) 0>Microsoft.CSharp.Core.targets(89,5): Error : at Microsoft.CodeAnalysis.CSharp.CodeGen.CodeGenerator.EmitUninstrumentedBlock(BoundBlock block) 0>Microsoft.CSharp.Core.targets(89,5): Error : at Microsoft.CodeAnalysis.CSharp.CodeGen.CodeGenerator.EmitStatement(BoundStatement statement) 0>Microsoft.CSharp.Core.targets(89,5): Error : at Microsoft.CodeAnalysis.CSharp.CodeGen.CodeGenerator.GenerateImpl() 0>Microsoft.CSharp.Core.targets(89,5): Error : at Microsoft.CodeAnalysis.CSharp.MethodCompiler.GenerateMethodBody(PEModuleBuilder moduleBuilder, MethodSymbol method, Int32 methodOrdinal, BoundStatement block, ImmutableArray`1 lambdaDebugInfo, ImmutableArray`1 orderedLambdaRuntimeRudeEdits, ImmutableArray`1 closureDebugInfo, ImmutableArray`1 stateMachineStateDebugInfos, StateMachineTypeSymbol stateMachineTypeOpt, VariableSlotAllocator variableSlotAllocatorOpt, BindingDiagnosticBag diagnostics, DebugDocumentProvider debugDocumentProvider, ImportChain importChainOpt, Boolean emittingPdb, ImmutableArray`1 codeCoverageSpans, AsyncForwardEntryPoint entryPointOpt) 0>Microsoft.CSharp.Core.targets(89,5): Error : at Microsoft.CodeAnalysis.CSharp.MethodCompiler.CompileSynthesizedMethods(TypeCompilationState compilationState) 0>Microsoft.CSharp.Core.targets(89,5): Error : at Microsoft.CodeAnalysis.CSharp.MethodCompiler.CompileNamedType(NamedTypeSymbol containingType) 0>Microsoft.CSharp.Core.targets(89,5): Error : at Microsoft.CodeAnalysis.CSharp.MethodCompiler.<>c__DisplayClass25_0.<CompileNamedTypeAsync>b__0() 0>------- Finished building project: ConsoleApp2. Succeeded: False. Errors: 59. Warnings: 0
@AlekseyTs suspect this is a dupe of #75569 but will let you confirm.
If i compile this with .net 9.0.100-rc.2.24474.11 on my arm64 mac, roslyn exits with an unhandled exception: