Please do not reply to this email- if you want to comment on the bug, go to the URL shown below and enter your comments there.
Changed by [EMAIL PROTECTED] http://bugzilla.ximian.com/show_bug.cgi?id=82571 --- shadow/82571 2007-08-24 10:18:58.000000000 -0400 +++ shadow/82571.tmp.18315 2007-08-24 10:18:58.000000000 -0400 @@ -0,0 +1,59 @@ +Bug#: 82571 +Product: Mono: Compilers +Version: unspecified +OS: +OS Details: Compiling on Ubuntu/Dapper; running on Windows XP + .NET 2.0 +Status: NEW +Resolution: +Severity: +Priority: Wishlist +Component: C# +AssignedTo: [EMAIL PROTECTED] +ReportedBy: [EMAIL PROTECTED] +QAContact: [EMAIL PROTECTED] +TargetMilestone: --- +URL: +Cc: +Summary: anonymous delegates, gmcs, and Microsoft.NET permissions checking problems + +Using mono from svn://anonsvn.mono-project.com/source/trunk/[EMAIL PROTECTED] + +The program listed below works fine when run compiled with latest gmcs and +run under Linux, but gives the following exception when run in Windows: + +Unhandled Exception: System.MethodAccessException: +<>c__CompilerGenerated0.<Main>c__1() + at MyClass.Main() + +However, compiling it with Microsoft's csc.exe from .NET 2.0 results +in a binary that works in both Linux (mono) and Windows (.NET). + +The command line I'm using to compile (under Cygwin) is: + /c/WINDOWS/Microsoft.NET/Framework/v2.0.50727/csc.exe bug.cs +or in Linux: + gmcs bug.cs + +I also have gmcs (release) version 1.1.13.6 installed via +Ubuntu/dapper. Compiling and running the binary with that version +works fine in both Linux and Windows. + +Commenting out the two lines of code relating to the delegate in the +sample program also makes it work fine. The crash occurs even if I +comment out the line calling the delegate (except I get an unused +variable warning, of course). + + +using System; + +public static class MyClass +{ + public delegate void Foo(); + + public static void Main() + { + Console.WriteLine("hello"); + Foo x = delegate() {}; + x(); + Console.WriteLine("goodbye"); + } +} _______________________________________________ mono-bugs maillist - [email protected] http://lists.ximian.com/mailman/listinfo/mono-bugs
