This project is read-only.
1

Resolved

C# Compiler crashes if a declaration expression is used in base constructor call

description

Try to compile:
class B(params object[] x) { }
class C(int x) : B(var y = x, x) { }
C# compiler crashes:
Application: VBCSCompiler.exe
Framework Version: v4.0.30319
Description: The application requested process termination through System.Environment.FailFast(string message).
Message: The given key was not present in the dictionary.
Stack:
   at System.Environment.FailFast(System.String, System.Exception)
   at Microsoft.CodeAnalysis.CompilerFatalError.Report(System.Exception)
   at Microsoft.CodeAnalysis.CSharp.MethodBodyCompiler+<>c__DisplayClass6.<CompileNamedTypeAsTask>b__8()
   at System.Collections.Generic.Dictionary`2[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].get_Item(System.__Canon)
   at Microsoft.CodeAnalysis.CSharp.CodeGen.CodeGenerator.EmitStore(Microsoft.CodeAnalysis.CSharp.BoundAssignmentOperator)
   at Microsoft.CodeAnalysis.CSharp.CodeGen.CodeGenerator.EmitAssignmentExpression(Microsoft.CodeAnalysis.CSharp.BoundAssignmentOperator, Boolean)
   at Microsoft.CodeAnalysis.CSharp.CodeGen.CodeGenerator.EmitExpression(Microsoft.CodeAnalysis.CSharp.BoundExpression, Boolean)
   at Microsoft.CodeAnalysis.CSharp.CodeGen.CodeGenerator.EmitSideEffects(Microsoft.CodeAnalysis.CSharp.BoundSequence)
   at Microsoft.CodeAnalysis.CSharp.CodeGen.CodeGenerator.EmitSequenceExpression(Microsoft.CodeAnalysis.CSharp.BoundSequence, Boolean)
   at Microsoft.CodeAnalysis.CSharp.CodeGen.CodeGenerator.EmitExpression(Microsoft.CodeAnalysis.CSharp.BoundExpression, Boolean)
   at Microsoft.CodeAnalysis.CSharp.CodeGen.CodeGenerator.EmitConversionExpression(Microsoft.CodeAnalysis.CSharp.BoundConversion, Boolean)
   at Microsoft.CodeAnalysis.CSharp.CodeGen.CodeGenerator.EmitExpression(Microsoft.CodeAnalysis.CSharp.BoundExpression, Boolean)
   at Microsoft.CodeAnalysis.CSharp.CodeGen.CodeGenerator.EmitVectorElementInitializers(Microsoft.CodeAnalysis.CSharp.Symbols.ArrayTypeSymbol, System.Collections.Immutable.ImmutableArray`1<Microsoft.CodeAnalysis.CSharp.BoundExpression>, Boolean)
   at Microsoft.CodeAnalysis.CSharp.CodeGen.CodeGenerator.EmitElementInitializers(Microsoft.CodeAnalysis.CSharp.Symbols.ArrayTypeSymbol, System.Collections.Immutable.ImmutableArray`1<Microsoft.CodeAnalysis.CSharp.BoundExpression>, Boolean)
   at Microsoft.CodeAnalysis.CSharp.CodeGen.CodeGenerator.EmitArrayInitializers(Microsoft.CodeAnalysis.CSharp.Symbols.ArrayTypeSymbol, Microsoft.CodeAnalysis.CSharp.BoundArrayInitialization)
   at Microsoft.CodeAnalysis.CSharp.CodeGen.CodeGenerator.EmitArrayCreationExpression(Microsoft.CodeAnalysis.CSharp.BoundArrayCreation, Boolean)
   at Microsoft.CodeAnalysis.CSharp.CodeGen.CodeGenerator.EmitExpression(Microsoft.CodeAnalysis.CSharp.BoundExpression, Boolean)
   at Microsoft.CodeAnalysis.CSharp.CodeGen.CodeGenerator.EmitArguments(System.Collections.Immutable.ImmutableArray`1<Microsoft.CodeAnalysis.CSharp.BoundExpression>, System.Collections.Immutable.ImmutableArray`1<Microsoft.CodeAnalysis.CSharp.Symbols.ParameterSymbol>)
   at Microsoft.CodeAnalysis.CSharp.CodeGen.CodeGenerator.EmitCallExpression(Microsoft.CodeAnalysis.CSharp.BoundCall, Boolean)
   at Microsoft.CodeAnalysis.CSharp.CodeGen.CodeGenerator.EmitExpression(Microsoft.CodeAnalysis.CSharp.BoundExpression, Boolean)
   at Microsoft.CodeAnalysis.CSharp.CodeGen.CodeGenerator.EmitStatement(Microsoft.CodeAnalysis.CSharp.BoundStatement)
   at Microsoft.CodeAnalysis.CSharp.CodeGen.CodeGenerator.EmitBlock(Microsoft.CodeAnalysis.CSharp.BoundBlock)
   at Microsoft.CodeAnalysis.CSharp.CodeGen.CodeGenerator.EmitStatement(Microsoft.CodeAnalysis.CSharp.BoundStatement)
   at Microsoft.CodeAnalysis.CSharp.CodeGen.CodeGenerator.EmitStatementList(Microsoft.CodeAnalysis.CSharp.BoundStatementList)
   at Microsoft.CodeAnalysis.CSharp.CodeGen.CodeGenerator.EmitStatement(Microsoft.CodeAnalysis.CSharp.BoundStatement)
   at Microsoft.CodeAnalysis.CSharp.CodeGen.CodeGenerator.Generate()
   at Microsoft.CodeAnalysis.CSharp.CodeGen.CodeGenerator.Run(Microsoft.CodeAnalysis.CSharp.Symbols.MethodSymbol, Microsoft.CodeAnalysis.CSharp.BoundStatement, Microsoft.CodeAnalysis.CodeGen.ILBuilder, Microsoft.CodeAnalysis.CSharp.Emit.PEModuleBuilder, Microsoft.CodeAnalysis.DiagnosticBag, Boolean, Boolean)
   at Microsoft.CodeAnalysis.CSharp.Compiler.GenerateMethodBody(Microsoft.CodeAnalysis.CSharp.TypeCompilationState, Microsoft.CodeAnalysis.CSharp.Symbols.MethodSymbol, Microsoft.CodeAnalysis.CSharp.BoundStatement, Microsoft.CodeAnalysis.DiagnosticBag, Boolean, System.Func`2<System.String,Microsoft.Cci.DebugSourceDocument>, System.Collections.Immutable.ImmutableArray`1<Microsoft.CodeAnalysis.CodeGen.NamespaceScope>)
   at Microsoft.CodeAnalysis.CSharp.MethodBodyCompiler.CompileMethod(Microsoft.CodeAnalysis.CSharp.Symbols.MethodSymbol, ProcessedFieldInitializers ByRef, Microsoft.CodeAnalysis.CSharp.SynthesizedSubmissionFields, Microsoft.CodeAnalysis.CSharp.TypeCompilationState)
   at Microsoft.CodeAnalysis.CSharp.MethodBodyCompiler.CompileNamedType(Microsoft.CodeAnalysis.CSharp.Symbols.NamedTypeSymbol)
   at Microsoft.CodeAnalysis.CSharp.MethodBodyCompiler+<>c__DisplayClass6.<CompileNamedTypeAsTask>b__8()
   at System.Threading.Tasks.Task`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].InnerInvoke()
   at System.Threading.Tasks.Task.Execute()
   at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
   at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
   at System.Threading.Tasks.Task.ExecuteWithThreadLocal(System.Threading.Tasks.Task ByRef)
   at System.Threading.Tasks.Task.ExecuteEntry(Boolean)
   at System.Threading.ThreadPoolWorkQueue.Dispatch()