This project is read-only.
1

Resolved

C# Compiler crashes if a declaration expression is used in a lamba within a constructor-initializer

description

using System;
using System.Linq.Expressions;

struct S
{
    S(int a) : this(() => (S s).GetType()) { }
    S(Expression<Action> e) { }
}
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.EmitLocalLoad(Microsoft.CodeAnalysis.CSharp.BoundLocal, 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.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.EmitConversionExpression(Microsoft.CodeAnalysis.CSharp.BoundConversion, 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.EmitConversionExpression(Microsoft.CodeAnalysis.CSharp.BoundConversion, 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.EmitSequenceExpression(Microsoft.CodeAnalysis.CSharp.BoundSequence, 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.EmitSequencePointStatement(Microsoft.CodeAnalysis.CSharp.BoundSequencePointWithSpan)
   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()

comments

angocke wrote Jul 1, 2014 at 7:41 PM

Fixed in changeset 2367e24199e107a63b290adf4ac6b9a84b7986dd