You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Expected Behavior:
Like in .NET 8, we get an appropriate error:
CS9244 The type 'ReadOnlySpan' may not be a ref struct or a type parameter allowing ref structs in order to use it as parameter 'T' in the generic type or method 'IEnumerable'
Actual Behavior:
csc.exe tries and fails to compile the above code.
dotnet build produces the following output:
PS D:\Code\test> dotnet build
Restore complete (0.2s)
test failed with 58 error(s) (8.0s)
C:\Program Files\dotnet\sdk\9.0.100\Roslyn\Microsoft.CSharp.Core.targets(89,5): error : Process terminated. System.InvalidOperationException: Unexpected value 'NoConversion' of type 'Microsoft.CodeAnalysis.CSharp.ConversionKind'
C:\Program Files\dotnet\sdk\9.0.100\Roslyn\Microsoft.CSharp.Core.targets(89,5): error : at Microsoft.CodeAnalysis.CSharp.CodeGen.CodeGenerator.EmitConversion(BoundConversion conversion)
C:\Program Files\dotnet\sdk\9.0.100\Roslyn\Microsoft.CSharp.Core.targets(89,5): error : at Microsoft.CodeAnalysis.CSharp.CodeGen.CodeGenerator.EmitConversionExpression(BoundConversion conversion, Boolean used)
C:\Program Files\dotnet\sdk\9.0.100\Roslyn\Microsoft.CSharp.Core.targets(89,5): error : at Microsoft.CodeAnalysis.CSharp.CodeGen.CodeGenerator.EmitExpressionCoreWithStackGuard(BoundExpression expression, Boolean used)
C:\Program Files\dotnet\sdk\9.0.100\Roslyn\Microsoft.CSharp.Core.targets(89,5): error : at Microsoft.CodeAnalysis.CSharp.CodeGen.CodeGenerator.EmitExpression(BoundExpression expression, Boolean used)
C:\Program Files\dotnet\sdk\9.0.100\Roslyn\Microsoft.CSharp.Core.targets(89,5): error : at Microsoft.CodeAnalysis.CSharp.CodeGen.CodeGenerator.EmitReturnStatement(BoundReturnStatement boundReturnStatement)
C:\Program Files\dotnet\sdk\9.0.100\Roslyn\Microsoft.CSharp.Core.targets(89,5): error : at Microsoft.CodeAnalysis.CSharp.CodeGen.CodeGenerator.EmitStatement(BoundStatement statement)
C:\Program Files\dotnet\sdk\9.0.100\Roslyn\Microsoft.CSharp.Core.targets(89,5): error : at Microsoft.CodeAnalysis.CSharp.CodeGen.CodeGenerator.EmitStatements(ImmutableArray`1 statements)
C:\Program Files\dotnet\sdk\9.0.100\Roslyn\Microsoft.CSharp.Core.targets(89,5): error : at Microsoft.CodeAnalysis.CSharp.CodeGen.CodeGenerator.EmitUninstrumentedBlock(BoundBlock block)
C:\Program Files\dotnet\sdk\9.0.100\Roslyn\Microsoft.CSharp.Core.targets(89,5): error : at Microsoft.CodeAnalysis.CSharp.CodeGen.CodeGenerator.EmitStatement(BoundStatement statement)
C:\Program Files\dotnet\sdk\9.0.100\Roslyn\Microsoft.CSharp.Core.targets(89,5): error : at Microsoft.CodeAnalysis.CSharp.CodeGen.CodeGenerator.GenerateImpl()
C:\Program Files\dotnet\sdk\9.0.100\Roslyn\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)
C:\Program Files\dotnet\sdk\9.0.100\Roslyn\Microsoft.CSharp.Core.targets(89,5): error : at Microsoft.CodeAnalysis.CSharp.MethodCompiler.CompileSynthesizedMethods(TypeCompilationState compilationState)
C:\Program Files\dotnet\sdk\9.0.100\Roslyn\Microsoft.CSharp.Core.targets(89,5): error : at Microsoft.CodeAnalysis.CSharp.MethodCompiler.CompileNamedType(NamedTypeSymbol containingType)
C:\Program Files\dotnet\sdk\9.0.100\Roslyn\Microsoft.CSharp.Core.targets(89,5): error : at Microsoft.CodeAnalysis.CSharp.MethodCompiler.<>c__DisplayClass25_0.<CompileNamedTypeAsync>b__0()
C:\Program Files\dotnet\sdk\9.0.100\Roslyn\Microsoft.CSharp.Core.targets(89,5): error : at System.Environment.FailFast(System.Runtime.CompilerServices.StackCrawlMarkHandle, System.String, System.Runtime.CompilerServices.ObjectHandleOnStack, System.String)
C:\Program Files\dotnet\sdk\9.0.100\Roslyn\Microsoft.CSharp.Core.targets(89,5): error : at System.Environment.FailFast(System.Threading.StackCrawlMark ByRef, System.String, System.Exception, System.String)
C:\Program Files\dotnet\sdk\9.0.100\Roslyn\Microsoft.CSharp.Core.targets(89,5): error : at System.Environment.FailFast(System.String, System.Exception)
C:\Program Files\dotnet\sdk\9.0.100\Roslyn\Microsoft.CSharp.Core.targets(89,5): error : at Microsoft.CodeAnalysis.FailFast.OnFatalException(System.Exception)
C:\Program Files\dotnet\sdk\9.0.100\Roslyn\Microsoft.CSharp.Core.targets(89,5): error : at Microsoft.CodeAnalysis.ErrorReporting.FatalError.Report(System.Exception, Microsoft.CodeAnalysis.ErrorReporting.ErrorSeverity, Boolean)
C:\Program Files\dotnet\sdk\9.0.100\Roslyn\Microsoft.CSharp.Core.targets(89,5): error : at Microsoft.CodeAnalysis.ErrorReporting.FatalError.ReportAndPropagateUnlessCanceled(System.Exception, Microsoft.CodeAnalysis.ErrorReporting.ErrorSeverity)
C:\Program Files\dotnet\sdk\9.0.100\Roslyn\Microsoft.CSharp.Core.targets(89,5): error : at Microsoft.CodeAnalysis.CSharp.MethodCompiler+<>c__DisplayClass25_0.<CompileNamedTypeAsync>b__0()
C:\Program Files\dotnet\sdk\9.0.100\Roslyn\Microsoft.CSharp.Core.targets(89,5): error : at System.Runtime.EH.FindFirstPassHandler(System.Object, UInt32, System.Runtime.StackFrameIterator ByRef, UInt32 ByRef, Byte* ByRef)
C:\Program Files\dotnet\sdk\9.0.100\Roslyn\Microsoft.CSharp.Core.targets(89,5): error : at System.Runtime.EH.DispatchEx(System.Runtime.StackFrameIterator ByRef, ExInfo ByRef)
C:\Program Files\dotnet\sdk\9.0.100\Roslyn\Microsoft.CSharp.Core.targets(89,5): error : at System.Runtime.EH.RhThrowEx(System.Object, ExInfo ByRef)
C:\Program Files\dotnet\sdk\9.0.100\Roslyn\Microsoft.CSharp.Core.targets(89,5): error : at Microsoft.CodeAnalysis.CSharp.CodeGen.CodeGenerator.EmitConversion(Microsoft.CodeAnalysis.CSharp.BoundConversion)
C:\Program Files\dotnet\sdk\9.0.100\Roslyn\Microsoft.CSharp.Core.targets(89,5): error : at Microsoft.CodeAnalysis.CSharp.CodeGen.CodeGenerator.EmitConversionExpression(Microsoft.CodeAnalysis.CSharp.BoundConversion, Boolean)
C:\Program Files\dotnet\sdk\9.0.100\Roslyn\Microsoft.CSharp.Core.targets(89,5): error : at Microsoft.CodeAnalysis.CSharp.CodeGen.CodeGenerator.EmitExpressionCoreWithStackGuard(Microsoft.CodeAnalysis.CSharp.BoundExpression, Boolean)
C:\Program Files\dotnet\sdk\9.0.100\Roslyn\Microsoft.CSharp.Core.targets(89,5): error : at Microsoft.CodeAnalysis.CSharp.CodeGen.CodeGenerator.EmitExpression(Microsoft.CodeAnalysis.CSharp.BoundExpression, Boolean)
C:\Program Files\dotnet\sdk\9.0.100\Roslyn\Microsoft.CSharp.Core.targets(89,5): error : at Microsoft.CodeAnalysis.CSharp.CodeGen.CodeGenerator.EmitReturnStatement(Microsoft.CodeAnalysis.CSharp.BoundReturnStatement)
C:\Program Files\dotnet\sdk\9.0.100\Roslyn\Microsoft.CSharp.Core.targets(89,5): error : at Microsoft.CodeAnalysis.CSharp.CodeGen.CodeGenerator.EmitStatement(Microsoft.CodeAnalysis.CSharp.BoundStatement)
C:\Program Files\dotnet\sdk\9.0.100\Roslyn\Microsoft.CSharp.Core.targets(89,5): error : at Microsoft.CodeAnalysis.CSharp.CodeGen.CodeGenerator.EmitStatements(System.Collections.Immutable.ImmutableArray`1<Microsoft.CodeAnalysis.CSharp.BoundStatement>)
C:\Program Files\dotnet\sdk\9.0.100\Roslyn\Microsoft.CSharp.Core.targets(89,5): error : at Microsoft.CodeAnalysis.CSharp.CodeGen.CodeGenerator.EmitUninstrumentedBlock(Microsoft.CodeAnalysis.CSharp.BoundBlock)
C:\Program Files\dotnet\sdk\9.0.100\Roslyn\Microsoft.CSharp.Core.targets(89,5): error : at Microsoft.CodeAnalysis.CSharp.CodeGen.CodeGenerator.EmitStatement(Microsoft.CodeAnalysis.CSharp.BoundStatement)
C:\Program Files\dotnet\sdk\9.0.100\Roslyn\Microsoft.CSharp.Core.targets(89,5): error : at Microsoft.CodeAnalysis.CSharp.CodeGen.CodeGenerator.GenerateImpl()
C:\Program Files\dotnet\sdk\9.0.100\Roslyn\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)
C:\Program Files\dotnet\sdk\9.0.100\Roslyn\Microsoft.CSharp.Core.targets(89,5): error : at Microsoft.CodeAnalysis.CSharp.MethodCompiler.CompileSynthesizedMethods(Microsoft.CodeAnalysis.CSharp.TypeCompilationState)
C:\Program Files\dotnet\sdk\9.0.100\Roslyn\Microsoft.CSharp.Core.targets(89,5): error : at Microsoft.CodeAnalysis.CSharp.MethodCompiler.CompileNamedType(Microsoft.CodeAnalysis.CSharp.Symbols.NamedTypeSymbol)
C:\Program Files\dotnet\sdk\9.0.100\Roslyn\Microsoft.CSharp.Core.targets(89,5): error : at Microsoft.CodeAnalysis.CSharp.MethodCompiler+<>c__DisplayClass25_0.<CompileNamedTypeAsync>b__0()
C:\Program Files\dotnet\sdk\9.0.100\Roslyn\Microsoft.CSharp.Core.targets(89,5): error : at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(System.Threading.Thread, System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
C:\Program Files\dotnet\sdk\9.0.100\Roslyn\Microsoft.CSharp.Core.targets(89,5): error : at System.Threading.Tasks.Task.ExecuteWithThreadLocal(System.Threading.Tasks.Task ByRef, System.Threading.Thread)
C:\Program Files\dotnet\sdk\9.0.100\Roslyn\Microsoft.CSharp.Core.targets(89,5): error : at System.Threading.ThreadPoolWorkQueue.Dispatch()
C:\Program Files\dotnet\sdk\9.0.100\Roslyn\Microsoft.CSharp.Core.targets(89,5): error : at System.Threading.PortableThreadPool+WorkerThread.WorkerThreadStart()
C:\Program Files\dotnet\sdk\9.0.100\Roslyn\Microsoft.CSharp.Core.targets(89,5): error : System.InvalidOperationException: Unexpected value 'NoConversion' of type 'Microsoft.CodeAnalysis.CSharp.ConversionKind'
C:\Program Files\dotnet\sdk\9.0.100\Roslyn\Microsoft.CSharp.Core.targets(89,5): error : at Microsoft.CodeAnalysis.CSharp.CodeGen.CodeGenerator.EmitConversion(BoundConversion conversion)
C:\Program Files\dotnet\sdk\9.0.100\Roslyn\Microsoft.CSharp.Core.targets(89,5): error : at Microsoft.CodeAnalysis.CSharp.CodeGen.CodeGenerator.EmitConversionExpression(BoundConversion conversion, Boolean used)
C:\Program Files\dotnet\sdk\9.0.100\Roslyn\Microsoft.CSharp.Core.targets(89,5): error : at Microsoft.CodeAnalysis.CSharp.CodeGen.CodeGenerator.EmitExpressionCoreWithStackGuard(BoundExpression expression, Boolean used)
C:\Program Files\dotnet\sdk\9.0.100\Roslyn\Microsoft.CSharp.Core.targets(89,5): error : at Microsoft.CodeAnalysis.CSharp.CodeGen.CodeGenerator.EmitExpression(BoundExpression expression, Boolean used)
C:\Program Files\dotnet\sdk\9.0.100\Roslyn\Microsoft.CSharp.Core.targets(89,5): error : at Microsoft.CodeAnalysis.CSharp.CodeGen.CodeGenerator.EmitReturnStatement(BoundReturnStatement boundReturnStatement)
C:\Program Files\dotnet\sdk\9.0.100\Roslyn\Microsoft.CSharp.Core.targets(89,5): error : at Microsoft.CodeAnalysis.CSharp.CodeGen.CodeGenerator.EmitStatement(BoundStatement statement)
C:\Program Files\dotnet\sdk\9.0.100\Roslyn\Microsoft.CSharp.Core.targets(89,5): error : at Microsoft.CodeAnalysis.CSharp.CodeGen.CodeGenerator.EmitStatements(ImmutableArray`1 statements)
C:\Program Files\dotnet\sdk\9.0.100\Roslyn\Microsoft.CSharp.Core.targets(89,5): error : at Microsoft.CodeAnalysis.CSharp.CodeGen.CodeGenerator.EmitUninstrumentedBlock(BoundBlock block)
C:\Program Files\dotnet\sdk\9.0.100\Roslyn\Microsoft.CSharp.Core.targets(89,5): error : at Microsoft.CodeAnalysis.CSharp.CodeGen.CodeGenerator.EmitStatement(BoundStatement statement)
C:\Program Files\dotnet\sdk\9.0.100\Roslyn\Microsoft.CSharp.Core.targets(89,5): error : at Microsoft.CodeAnalysis.CSharp.CodeGen.CodeGenerator.GenerateImpl()
C:\Program Files\dotnet\sdk\9.0.100\Roslyn\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)
C:\Program Files\dotnet\sdk\9.0.100\Roslyn\Microsoft.CSharp.Core.targets(89,5): error : at Microsoft.CodeAnalysis.CSharp.MethodCompiler.CompileSynthesizedMethods(TypeCompilationState compilationState)
C:\Program Files\dotnet\sdk\9.0.100\Roslyn\Microsoft.CSharp.Core.targets(89,5): error : at Microsoft.CodeAnalysis.CSharp.MethodCompiler.CompileNamedType(NamedTypeSymbol containingType)
C:\Program Files\dotnet\sdk\9.0.100\Roslyn\Microsoft.CSharp.Core.targets(89,5): error : at Microsoft.CodeAnalysis.CSharp.MethodCompiler.<>c__DisplayClass25_0.<CompileNamedTypeAsync>b__0()
The text was updated successfully, but these errors were encountered:
Version Used:
9.0.100
Steps to Reproduce:
dotnet new console
Program.cs
with this:Diagnostic Id:
Expected Behavior:
Like in .NET 8, we get an appropriate error:
CS9244 The type 'ReadOnlySpan' may not be a ref struct or a type parameter allowing ref structs in order to use it as parameter 'T' in the generic type or method 'IEnumerable'
Actual Behavior:
csc.exe tries and fails to compile the above code.
dotnet build
produces the following output:The text was updated successfully, but these errors were encountered: