https://bugzilla.novell.com/show_bug.cgi?id=356197
Summary: using a using block within a delegate causes segfault Product: Mono: Compilers Version: 1.2.6 Platform: Macintosh OS/Version: Mac OS X 10.4 Status: NEW Severity: Normal Priority: P5 - None Component: C# AssignedTo: mono-bugs@lists.ximian.com ReportedBy: [EMAIL PROTECTED] QAContact: mono-bugs@lists.ximian.com Found By: --- Created an attachment (id=191787) --> (https://bugzilla.novell.com/attachment.cgi?id=191787) test case Doing something of the form: public static void MyAction(Action<Object> action) { action(myObject); } public static void Main(string[] args) { MyAction(delegate(Object obj) { using (DisposableClass dc = new DisposableClass()) { } }); } causes the compile to fail, though if the using() block is removed, it compiles fine. $ gmcs test.cs Exception caught by the compiler while compiling: Block that caused the problem begin at: test.cs(21): Block being compiled: [test.cs(22):,test.cs(29):] Mono.CSharp.InternalErrorException: test.cs(23): Internal compiler error at test.cs(21):: exception caught while emitting MethodBuilder [Test::Main] Unhandled Exception: Mono.CSharp.InternalErrorException: test.cs(23): ---> System.InvalidCastException: Cannot cast from source type to destination type. at Mono.CSharp.Using.CloneTo (Mono.CSharp.CloneContext clonectx, Mono.CSharp.Statement t) [0x00000] at Mono.CSharp.Statement.Clone (Mono.CSharp.CloneContext clonectx) [0x00000] at Mono.CSharp.Block.CloneTo (Mono.CSharp.CloneContext clonectx, Mono.CSharp.Statement t) [0x00000] at Mono.CSharp.ExplicitBlock.CloneTo (Mono.CSharp.CloneContext clonectx, Mono.CSharp.Statement t) [0x00000] at Mono.CSharp.Statement.Clone (Mono.CSharp.CloneContext clonectx) [0x00000] at Mono.CSharp.Block.CloneTo (Mono.CSharp.CloneContext clonectx, Mono.CSharp.Statement t) [0x00000] at Mono.CSharp.ExplicitBlock.CloneTo (Mono.CSharp.CloneContext clonectx, Mono.CSharp.Statement t) [0x00000] at Mono.CSharp.ToplevelBlock.CloneTo (Mono.CSharp.CloneContext clonectx, Mono.CSharp.Statement t) [0x00000] at Mono.CSharp.Statement.Clone (Mono.CSharp.CloneContext clonectx) [0x00000] at Mono.CSharp.Statement.PerformClone () [0x00000] at Mono.CSharp.AnonymousMethodExpression.CompatibleMethod (Mono.CSharp.EmitContext ec, Mono.CSharp.TypeInferenceContext tic, System.Type return_type, System.Type delegate_type) [0x00000] at Mono.CSharp.AnonymousMethodExpression.Compatible (Mono.CSharp.EmitContext ec, System.Type delegate_type) [0x00000] --- End of inner exception stack trace --- at Mono.CSharp.AnonymousMethodExpression.Compatible (Mono.CSharp.EmitContext ec, System.Type delegate_type) [0x00000] at Mono.CSharp.AnonymousMethodExpression.ImplicitStandardConversionExists (System.Type delegate_type) [0x00000] at Mono.CSharp.Convert.ImplicitStandardConversionExists (Mono.CSharp.Expression expr, System.Type target_type) [0x00000] at Mono.CSharp.Convert.ImplicitConversionExists (Mono.CSharp.EmitContext ec, Mono.CSharp.Expression expr, System.Type target_type) [0x00000] at Mono.CSharp.MethodGroupExpr.IsApplicable (Mono.CSharp.EmitContext ec, System.Collections.ArrayList arguments, Int32 arg_count, System.Reflection.MethodBase& method) [0x00000] at Mono.CSharp.MethodGroupExpr.OverloadResolve (Mono.CSharp.EmitContext ec, System.Collections.ArrayList Arguments, Boolean may_fail, Location loc) [0x00000] at Mono.CSharp.Invocation.DoResolveOverload (Mono.CSharp.EmitContext ec) [0x00000] at Mono.CSharp.Invocation.DoResolve (Mono.CSharp.EmitContext ec) [0x00000] at Mono.CSharp.Expression.Resolve (Mono.CSharp.EmitContext ec, ResolveFlags flags) [0x00000] at Mono.CSharp.Expression.Resolve (Mono.CSharp.EmitContext ec) [0x00000] at Mono.CSharp.ExpressionStatement.ResolveStatement (Mono.CSharp.EmitContext ec) [0x00000] at Mono.CSharp.StatementExpression.Resolve (Mono.CSharp.EmitContext ec) [0x00000] at Mono.CSharp.Block.Resolve (Mono.CSharp.EmitContext ec) [0x00000] at Mono.CSharp.EmitContext.ResolveTopBlock (Mono.CSharp.EmitContext anonymous_method_host, Mono.CSharp.ToplevelBlock block, Mono.CSharp.Parameters ip, IMethodData md, System.Boolean& unreachable) [0x00000] $ gmcs --version Mono C# compiler version 1.2.6.0 -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the QA contact for the bug. You are the assignee for the bug. _______________________________________________ mono-bugs maillist - mono-bugs@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-bugs