dotgnu-general
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[DotGNU]Found a cscc bug with delegates and virtual functions


From: Adam Treat
Subject: [DotGNU]Found a cscc bug with delegates and virtual functions
Date: Wed, 4 Dec 2002 00:35:43 -0500
User-agent: KMail/1.4.7

Hello All,

Here is the code:

using System;

class Foo
{
        public delegate void Del ();
        
        public Foo ()
        {
                Del del = new Del (Baz);
                del.DynamicInvoke (new Object[] {});
        }
        
        public virtual void Baz ()
        {
                Console.WriteLine ("Foo Baz");
        }
}

class Bar: Foo
{
        public override void Baz ()
        {
                Console.WriteLine ("Bar Baz");
        }
}

class Test
{       
        public static void Main (String[] args)
        {
                Foo foo = new Bar ();
        }
}

And here are the results:

address@hidden:~$ mcs foo.cs
Compilation succeeded
address@hidden:~$ mono foo.exe
Bar Baz
address@hidden:~$ ilrun foo.exe
Bar Baz
address@hidden:~$ cscc -o foo.exe foo.cs
address@hidden:~$ ilrun foo.exe
Uncaught exception: System.Security.VerificationException: Could not verify 
the code
        at Bar..ctor()
        at Test.Main(String[])

address@hidden:~$ mono foo.exe

Unhandled Exception: System.NullReferenceException: A null value was found 
where an object instance was required
in (unmanaged) 00 .Foo:.ctor ()
in <0x00012> 00 .Bar:.ctor ()
in <0x00028> 00 .Test:Main (string[])

Note also that I've tested this program with Microsoft.NET and csc.  The code 
compiled fine and ran just like it should: "Bar Baz"

Cheers,

Adam


reply via email to

[Prev in Thread] Current Thread [Next in Thread]