https://bugzilla.novell.com/show_bug.cgi?id=382260


           Summary: Argument incorrect to static callback with same name as
                    instance method
           Product: Mono: Runtime
           Version: SVN
          Platform: Other
        OS/Version: Ubuntu
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: JIT
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]
         QAContact: [email protected]
          Found By: ---


When a static callback has the same name as an instance method, the argument
passed to the static is the this pointer rather than the expected argument.

Removing the static keyword for StaticCallback gives expected behavior.
Renaming the method also gives expected behavior.

[TestFixture]
public class StaticDelegateWithSameNameAsInstance
{
    private Provider _provider;
    delegate void Provider(string s);

    Provider MyProvider
    {
        set
        {
            _provider = value;
            if (_provider != null)
            {
                _provider(string.Empty);
            }
        }
    }

    [Test]
    public void StaticCallback()
    {
        MyProvider = StaticCallback;
    }

    public static void StaticCallback(string s)
    {
        Assert.IsTrue(s is string, "s must be a string");
    }
}


-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
_______________________________________________
mono-bugs maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-bugs

Reply via email to