dotgnu-pnet
[Top][All Lists]
Advanced

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

[Pnet-developers] A verifier bug , curious one too


From: Gopal V
Subject: [Pnet-developers] A verifier bug , curious one too
Date: Fri, 9 May 2003 02:31:52 +0530
User-agent: Mutt/1.2.5i

Hi All,
        This has to do with the use of delegate variables as the parameter
to a delegate creation expression ...

So the code used is 

                Blah f = new Blah ();

                MyDelegate del = new MyDelegate (f.Foo);

                MyDelegate another = new MyDelegate (del);

Generated :
        .locals init    (class 'Blah', class 'MyDelegate', class 'MyDelegate')
        newobj  instance void 'Blah'::'.ctor'()
        stloc.0
        ldloc.0
        ldftn   instance int32 'Blah'::'Foo'(int32, int32)
        newobj  instance void 'MyDelegate'::.ctor(class 
[.library]System.Object, native int)
        stloc.1
        ldloc.1
        dup
        ldvirtftn       instance int32 'MyDelegate'::'Invoke'(int32, int32)
        newobj  instance void 'MyDelegate'::.ctor(class 
[.library]System.Object, native int)
        stloc.2

        The verifier exception is thrown in the second ldvirtftn because some
how it loads the Blah.Foo() directly ... since the stack is now 

<Blah.Foo>
<MyDelegate>

The verifier exits with a security exception .. saying the "MyDelegate" is
not assigncompatible to "Blah". From the looks, the code generated is fine , 
though my interpretation of the spec might be the problem here ...

Will report in savannah as soon as we reach the assumption that "this won't
be fixed in a jiffy" .. :-)

Gopal
PS: and thus ends a hard night's hacking on pnet
-- 
The difference between insanity and genius is measured by success

Attachment: delegate4.cs
Description: Text document


reply via email to

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