Bug 28069

Summary: Compiler Crash, async, not existing variable
Product: [Mono] Compilers Reporter: Andrius Bentkus <toxedvirus>
Component: C#Assignee: Marek Safar <masafa>
Status: RESOLVED FIXED    
Severity: normal CC: mono-bugs+mono
Priority: ---    
Version: 3.12.0   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Tags: Is this bug a regression?: ---
Last known good build:

Description Andrius Bentkus 2015-03-16 11:39:44 UTC
csharp> using System.Threading.Tasks;
csharp> Task.Run(async () => { var a = async () => { }; Console.WriteLine(a); });
Mono.CSharp.InternalErrorException: (1,1): InteractiveHost ---> Mono.CSharp.InternalErrorException: (1,11): ---> System.InvalidCastException: Cannot cast from source type to destination type.
  at Mono.CSharp.Convert.ImplicitConversionStandard (Mono.CSharp.ResolveContext ec, Mono.CSharp.Expression expr, Mono.CSharp.TypeSpec target_type, Location loc, Boolean explicit_cast) [0x00000] in <filename unknown>:0 
  at Mono.CSharp.Convert.ImplicitConversionStandard (Mono.CSharp.ResolveContext ec, Mono.CSharp.Expression expr, Mono.CSharp.TypeSpec target_type, Location loc) [0x00000] in <filename unknown>:0 
  at Mono.CSharp.Convert.ImplicitConversion (Mono.CSharp.ResolveContext ec, Mono.CSharp.Expression expr, Mono.CSharp.TypeSpec target_type, Location loc) [0x00000] in <filename unknown>:0 
  at Mono.CSharp.OverloadResolver.VerifyArguments (Mono.CSharp.ResolveContext ec, Mono.CSharp.Arguments& args, Mono.CSharp.MemberSpec member, IParametersMember pm, Boolean chose_params_expanded) [0x00000] in <filename unknown>:0 
  at Mono.CSharp.OverloadResolver.ReportOverloadError (Mono.CSharp.ResolveContext rc, Mono.CSharp.MemberSpec best_candidate, IParametersMember pm, Mono.CSharp.Arguments args, Boolean params_expanded) [0x00000] in <filename unknown>:0 
  at Mono.CSharp.OverloadResolver.ResolveMember[MethodSpec] (Mono.CSharp.ResolveContext rc, Mono.CSharp.Arguments& args) [0x00000] in <filename unknown>:0 
  at Mono.CSharp.MethodGroupExpr.OverloadResolve (Mono.CSharp.ResolveContext ec, Mono.CSharp.Arguments& args, IErrorHandler cerrors, Restrictions restr) [0x00000] in <filename unknown>:0 
  at Mono.CSharp.Invocation.DoResolveOverload (Mono.CSharp.ResolveContext ec) [0x00000] in <filename unknown>:0 
  at Mono.CSharp.Invocation.DoResolveInvocation (Mono.CSharp.ResolveContext ec) [0x00000] in <filename unknown>:0 
  at Mono.CSharp.Invocation.DoResolve (Mono.CSharp.ResolveContext rc) [0x00000] in <filename unknown>:0 
  at Mono.CSharp.Expression.Resolve (Mono.CSharp.ResolveContext ec, ResolveFlags flags) [0x00000] in <filename unknown>:0 
  --- End of inner exception stack trace ---
  at Mono.CSharp.AnonymousMethodExpression.Compatible (Mono.CSharp.ResolveContext ec, Mono.CSharp.TypeSpec type) [0x00000] in <filename unknown>:0 
  at Mono.CSharp.AnonymousMethodExpression.ImplicitStandardConversionExists (Mono.CSharp.ResolveContext ec, Mono.CSharp.TypeSpec delegate_type) [0x00000] in <filename unknown>:0 
  at Mono.CSharp.Convert.ImplicitConversionExists (Mono.CSharp.ResolveContext ec, Mono.CSharp.Expression expr, Mono.CSharp.TypeSpec target_type) [0x00000] in <filename unknown>:0 
  at Mono.CSharp.OverloadResolver.IsArgumentCompatible (Mono.CSharp.ResolveContext ec, Mono.CSharp.Argument argument, Modifier param_mod, Mono.CSharp.TypeSpec parameter) [0x00000] in <filename unknown>:0 
  at Mono.CSharp.OverloadResolver.IsApplicable (Mono.CSharp.ResolveContext ec, Mono.CSharp.Arguments& arguments, Int32 arg_count, Mono.CSharp.MemberSpec& candidate, IParametersMember pm, System.Boolean& params_expanded_form, System.Boolean& dynamicArgument, Mono.CSharp.TypeSpec& returnType, Boolean errorMode) [0x00000] in <filename unknown>:0 
  at Mono.CSharp.OverloadResolver.ResolveMember[MethodSpec] (Mono.CSharp.ResolveContext rc, Mono.CSharp.Arguments& args) [0x00000] in <filename unknown>:0 
  at Mono.CSharp.MethodGroupExpr.OverloadResolve (Mono.CSharp.ResolveContext ec, Mono.CSharp.Arguments& args, IErrorHandler cerrors, Restrictions restr) [0x00000] in <filename unknown>:0 
  at Mono.CSharp.Invocation.DoResolveOverload (Mono.CSharp.ResolveContext ec) [0x00000] in <filename unknown>:0 
  at Mono.CSharp.Invocation.DoResolveInvocation (Mono.CSharp.ResolveContext ec) [0x00000] in <filename unknown>:0 
  at Mono.CSharp.Invocation.DoResolve (Mono.CSharp.ResolveContext rc) [0x00000] in <filename unknown>:0 
  at Mono.CSharp.Expression.Resolve (Mono.CSharp.ResolveContext ec, ResolveFlags flags) [0x00000] in <filename unknown>:0 
  --- End of inner exception stack trace ---
  at Mono.CSharp.Method.Emit () [0x00000] in <filename unknown>:0 
  at Mono.CSharp.TypeDefinition.Emit () [0x00000] in <filename unknown>:0 
  at Mono.CSharp.ClassOrStruct.Emit () [0x00000] in <filename unknown>:0 
  at Mono.CSharp.Class.Emit () [0x00000] in <filename unknown>:0 
  at Mono.CSharp.TypeDefinition.EmitContainer () [0x00000] in <filename unknown>:0 
  at Mono.CSharp.Evaluator.CompileBlock (Mono.CSharp.Class host, Mono.CSharp.Undo undo, Mono.CSharp.Report Report) [0x00000] in <filename unknown>:0 
  at Mono.CSharp.Evaluator.Compile (System.String input, Mono.CSharp.CompiledMethod& compiled) [0x00000] in <filename unknown>:0 
  at Mono.CSharp.Evaluator.Evaluate (System.String input, System.Object& result, System.Boolean& result_set) [0x00000] in <filename unknown>:0 
  at Mono.CSharpShell.Evaluate (System.String input) [0x00000] in <filename unknown>:0 


The minimal testcode is: Task.Run(async () => { var a = async () => { }; Console.WriteLine(a); });
Comment 1 Marek Safar 2015-04-16 10:32:50 UTC
Fixed in master