Bug 3433 - Mono Complier crashes when using a Delegate Type as a Method call.
Summary: Mono Complier crashes when using a Delegate Type as a Method call.
Status: CLOSED INVALID
Alias: None
Product: Compilers
Classification: Mono
Component: C# ()
Version: unspecified
Hardware: PC Mac OS
: --- normal
Target Milestone: ---
Assignee: Marek Safar
URL:
Depends on:
Blocks:
 
Reported: 2012-02-13 18:21 UTC by Eric Beisecker
Modified: 2012-02-13 18:25 UTC (History)
1 user (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
CLOSED INVALID

Description Eric Beisecker 2012-02-13 18:21:33 UTC
Current Behavior: When using a Delegate type declaration as a Method call the mono compiler crashes.

Expected Behavior: The Compiler should throw an error along the lines of "Namespace.DelegateType is a 'type' but is used like a 'variable'"

Sample Code 

namespace Test
{
    public delegate void SomeDel(Action a);
    
    public class TestClass
    {
         public void TestMethod()
         {
            SomethingCool(() => { int i = 0; };
         }
    }
} 

Mono 2.10.8
MonoDevelop 2.8.6.4


build output

Performing main compilation...
/Library/Frameworks/Mono.framework/Versions/2.10.8/bin/gmcs /noconfig "/out:/Users/ebeisecker/Projects/HelloWorld/HelloWorld/bin/Debug/HelloWorld.exe" "/r:/Library/Frameworks/Mono.framework/Versions/2.10.8/lib/mono/2.0/System.dll" "/r:/Library/Frameworks/Mono.framework/Versions/2.10.8/lib/mono/2.0/System.Core.dll" /nologo /warn:4 /debug:+ /debug:full /optimize- /codepage:utf8 /platform:x86 "/define:DEBUG"  /t:exe "/Users/ebeisecker/Projects/HelloWorld/HelloWorld/Main.cs" "/Users/ebeisecker/Projects/HelloWorld/HelloWorld/AssemblyInfo.cs" "/Users/ebeisecker/Projects/HelloWorld/HelloWorld/Class1.cs" 


Unhandled Exception: Mono.CSharp.InternalErrorException: /Users/ebeisecker/Projects/HelloWorld/HelloWorld/Class1.cs(11,24): TestConsoleApp.Class1.Class1() ---> Mono.CSharp.InternalErrorException: FullNamedExpression `TestConsoleApp.SomeDel' found in resolved tree
  at Mono.CSharp.FullNamedExpression.Emit (Mono.CSharp.EmitContext ec) [0x00000] in <filename unknown>:0 
  at Mono.CSharp.Invocation.EmitCall (Mono.CSharp.EmitContext ec, Mono.CSharp.Expression instance_expr, Mono.CSharp.MethodSpec method, Mono.CSharp.Arguments Arguments, Location loc, Boolean dup_args, Boolean omit_args) [0x00000] in <filename unknown>:0 
  at Mono.CSharp.Invocation.EmitCall (Mono.CSharp.EmitContext ec, Mono.CSharp.Expression instance_expr, Mono.CSharp.MethodSpec method, Mono.CSharp.Arguments Arguments, Location loc) [0x00000] in <filename unknown>:0 
  at Mono.CSharp.DelegateInvocation.Emit (Mono.CSharp.EmitContext ec) [0x00000] in <filename unknown>:0 
  at Mono.CSharp.DelegateInvocation.EmitStatement (Mono.CSharp.EmitContext ec) [0x00000] in <filename unknown>:0 
  at Mono.CSharp.StatementExpression.DoEmit (Mono.CSharp.EmitContext ec) [0x00000] in <filename unknown>:0 
  at Mono.CSharp.Statement.Emit (Mono.CSharp.EmitContext ec) [0x00000] in <filename unknown>:0 
  at Mono.CSharp.Block.DoEmit (Mono.CSharp.EmitContext ec) [0x00000] in <filename unknown>:0 
  at Mono.CSharp.Block.Emit (Mono.CSharp.EmitContext ec) [0x00000] in <filename unknown>:0 
  at Mono.CSharp.ExplicitBlock.Emit (Mono.CSharp.EmitContext ec) [0x00000] in <filename unknown>:0 
  at Mono.CSharp.ToplevelBlock.Emit (Mono.CSharp.EmitContext ec) [0x00000] in <filename unknown>:0 
  at Mono.CSharp.Constructor.Emit () [0x00000] in <filename unknown>:0 
  at Mono.CSharp.TypeContainer.EmitConstructors () [0x00000] in <filename unknown>:0 
  --- End of inner exception stack trace ---
  at Mono.CSharp.TypeContainer.EmitConstructors () [0x00000] in <filename unknown>:0 
  at Mono.CSharp.TypeContainer.EmitType () [0x00000] in <filename unknown>:0 
  at Mono.CSharp.ModuleContainer.Emit () [0x00000] in <filename unknown>:0 
  at Mono.CSharp.AssemblyDefinition.Emit () [0x00000] in <filename unknown>:0 
  at Mono.CSharp.Driver.Compile () [0x00000] in <filename unknown>:0 
  at Mono.CSharp.Driver.Main (System.String[] args) [0x00000] in <filename unknown>:0 
[ERROR] FATAL UNHANDLED EXCEPTION: Mono.CSharp.InternalErrorException: /Users/ebeisecker/Projects/HelloWorld/HelloWorld/Class1.cs(11,24): TestConsoleApp.Class1.Class1() ---> Mono.CSharp.InternalErrorException: FullNamedExpression `TestConsoleApp.SomeDel' found in resolved tree
  at Mono.CSharp.FullNamedExpression.Emit (Mono.CSharp.EmitContext ec) [0x00000] in <filename unknown>:0 
  at Mono.CSharp.Invocation.EmitCall (Mono.CSharp.EmitContext ec, Mono.CSharp.Expression instance_expr, Mono.CSharp.MethodSpec method, Mono.CSharp.Arguments Arguments, Location loc, Boolean dup_args, Boolean omit_args) [0x00000] in <filename unknown>:0 
  at Mono.CSharp.Invocation.EmitCall (Mono.CSharp.EmitContext ec, Mono.CSharp.Expression instance_expr, Mono.CSharp.MethodSpec method, Mono.CSharp.Arguments Arguments, Location loc) [0x00000] in <filename unknown>:0 
  at Mono.CSharp.DelegateInvocation.Emit (Mono.CSharp.EmitContext ec) [0x00000] in <filename unknown>:0 
  at Mono.CSharp.DelegateInvocation.EmitStatement (Mono.CSharp.EmitContext ec) [0x00000] in <filename unknown>:0 
  at Mono.CSharp.StatementExpression.DoEmit (Mono.CSharp.EmitContext ec) [0x00000] in <filename unknown>:0 
  at Mono.CSharp.Statement.Emit (Mono.CSharp.EmitContext ec) [0x00000] in <filename unknown>:0 
  at Mono.CSharp.Block.DoEmit (Mono.CSharp.EmitContext ec) [0x00000] in <filename unknown>:0 
  at Mono.CSharp.Block.Emit (Mono.CSharp.EmitContext ec) [0x00000] in <filename unknown>:0 
  at Mono.CSharp.ExplicitBlock.Emit (Mono.CSharp.EmitContext ec) [0x00000] in <filename unknown>:0 
  at Mono.CSharp.ToplevelBlock.Emit (Mono.CSharp.EmitContext ec) [0x00000] in <filename unknown>:0 
  at Mono.CSharp.Constructor.Emit () [0x00000] in <filename unknown>:0 
  at Mono.CSharp.TypeContainer.EmitConstructors () [0x00000] in <filename unknown>:0 
  --- End of inner exception stack trace ---
  at Mono.CSharp.TypeContainer.EmitConstructors () [0x00000] in <filename unknown>:0 
  at Mono.CSharp.TypeContainer.EmitType () [0x00000] in <filename unknown>:0 
  at Mono.CSharp.ModuleContainer.Emit () [0x00000] in <filename unknown>:0 
  at Mono.CSharp.AssemblyDefinition.Emit () [0x00000] in <filename unknown>:0 
  at Mono.CSharp.Driver.Compile () [0x00000] in <filename unknown>:0 
  at Mono.CSharp.Driver.Main (System.String[] args) [0x00000] in <filename unknown>:0 



Unhandled Exception: Mono.CSharp.InternalErrorException: /Users/ebeisecker/Projects/HelloWorld/HelloWorld/Class1.cs(11,24): TestConsoleApp.Class1.Class1() ---> Mono.CSharp.InternalErrorException: FullNamedExpression `TestConsoleApp.SomeDel' found in resolved tree
  at Mono.CSharp.FullNamedExpression.Emit (Mono.CSharp.EmitContext ec) [0x00000] in <filename unknown>:0 
  at Mono.CSharp.Invocation.EmitCall (Mono.CSharp.EmitContext ec, Mono.CSharp.Expression instance_expr, Mono.CSharp.MethodSpec method, Mono.CSharp.Arguments Arguments, Location loc, Boolean dup_args, Boolean omit_args) [0x00000] in <filename unknown>:0 
  at Mono.CSharp.Invocation.EmitCall (Mono.CSharp.EmitContext ec, Mono.CSharp.Expression instance_expr, Mono.CSharp.MethodSpec method, Mono.CSharp.Arguments Arguments, Location loc) [0x00000] in <filename unknown>:0 
  at Mono.CSharp.DelegateInvocation.Emit (Mono.CSharp.EmitContext ec) [0x00000] in <filename unknown>:0 
  at Mono.CSharp.DelegateInvocation.EmitStatement (Mono.CSharp.EmitContext ec) [0x00000] in <filename unknown>:0 
  at Mono.CSharp.StatementExpression.DoEmit (Mono.CSharp.EmitContext ec) [0x00000] in <filename unknown>:0 
  at Mono.CSharp.Statement.Emit (Mono.CSharp.EmitContext ec) [0x00000] in <filename unknown>:0 
  at Mono.CSharp.Block.DoEmit (Mono.CSharp.EmitContext ec) [0x00000] in <filename unknown>:0 
  at Mono.CSharp.Block.Emit (Mono.CSharp.EmitContext ec) [0x00000] in <filename unknown>:0 
  at Mono.CSharp.ExplicitBlock.Emit (Mono.CSharp.EmitContext ec) [0x00000] in <filename unknown>:0 
  at Mono.CSharp.ToplevelBlock.Emit (Mono.CSharp.EmitContext ec) [0x00000] in <filename unknown>:0 
  at Mono.CSharp.Constructor.Emit () [0x00000] in <filename unknown>:0 
  at Mono.CSharp.TypeContainer.EmitConstructors () [0x00000] in <filename unknown>:0 
  --- End of inner exception stack trace ---
  at Mono.CSharp.TypeContainer.EmitConstructors () [0x00000] in <filename unknown>:0 
  at Mono.CSharp.TypeContainer.EmitType () [0x00000] in <filename unknown>:0 
  at Mono.CSharp.ModuleContainer.Emit () [0x00000] in <filename unknown>:0 
  at Mono.CSharp.AssemblyDefinition.Emit () [0x00000] in <filename unknown>:0 
  at Mono.CSharp.Driver.Compile () [0x00000] in <filename unknown>:0 
  at Mono.CSharp.Driver.Main (System.String[] args) [0x00000] in <filename unknown>:0 
[ERROR] FATAL UNHANDLED EXCEPTION: Mono.CSharp.InternalErrorException: /Users/ebeisecker/Projects/HelloWorld/HelloWorld/Class1.cs(11,24): TestConsoleApp.Class1.Class1() ---> Mono.CSharp.InternalErrorException: FullNamedExpression `TestConsoleApp.SomeDel' found in resolved tree
  at Mono.CSharp.FullNamedExpression.Emit (Mono.CSharp.EmitContext ec) [0x00000] in <filename unknown>:0 
  at Mono.CSharp.Invocation.EmitCall (Mono.CSharp.EmitContext ec, Mono.CSharp.Expression instance_expr, Mono.CSharp.MethodSpec method, Mono.CSharp.Arguments Arguments, Location loc, Boolean dup_args, Boolean omit_args) [0x00000] in <filename unknown>:0 
  at Mono.CSharp.Invocation.EmitCall (Mono.CSharp.EmitContext ec, Mono.CSharp.Expression instance_expr, Mono.CSharp.MethodSpec method, Mono.CSharp.Arguments Arguments, Location loc) [0x00000] in <filename unknown>:0 
  at Mono.CSharp.DelegateInvocation.Emit (Mono.CSharp.EmitContext ec) [0x00000] in <filename unknown>:0 
  at Mono.CSharp.DelegateInvocation.EmitStatement (Mono.CSharp.EmitContext ec) [0x00000] in <filename unknown>:0 
  at Mono.CSharp.StatementExpression.DoEmit (Mono.CSharp.EmitContext ec) [0x00000] in <filename unknown>:0 
  at Mono.CSharp.Statement.Emit (Mono.CSharp.EmitContext ec) [0x00000] in <filename unknown>:0 
  at Mono.CSharp.Block.DoEmit (Mono.CSharp.EmitContext ec) [0x00000] in <filename unknown>:0 
  at Mono.CSharp.Block.Emit (Mono.CSharp.EmitContext ec) [0x00000] in <filename unknown>:0 
  at Mono.CSharp.ExplicitBlock.Emit (Mono.CSharp.EmitContext ec) [0x00000] in <filename unknown>:0 
  at Mono.CSharp.ToplevelBlock.Emit (Mono.CSharp.EmitContext ec) [0x00000] in <filename unknown>:0 
  at Mono.CSharp.Constructor.Emit () [0x00000] in <filename unknown>:0 
  at Mono.CSharp.TypeContainer.EmitConstructors () [0x00000] in <filename unknown>:0 
  --- End of inner exception stack trace ---
  at Mono.CSharp.TypeContainer.EmitConstructors () [0x00000] in <filename unknown>:0 
  at Mono.CSharp.TypeContainer.EmitType () [0x00000] in <filename unknown>:0 
  at Mono.CSharp.ModuleContainer.Emit () [0x00000] in <filename unknown>:0 
  at Mono.CSharp.AssemblyDefinition.Emit () [0x00000] in <filename unknown>:0 
  at Mono.CSharp.Driver.Compile () [0x00000] in <filename unknown>:0 
  at Mono.CSharp.Driver.Main (System.String[] args) [0x00000] in <filename unknown>:0 
Build complete -- 1 error, 0 warnings
Comment 1 Eric Beisecker 2012-02-13 18:25:18 UTC
Re-creating bug as this one is hard to read.