[Mono-bugs] [Bug 382260] New: Argument incorrect to static callback with same name as instance method

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Tue Apr 22 05:56:36 EDT 2008


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: lupus at novell.com
        ReportedBy: albright at wesay.org
         QAContact: mono-bugs at lists.ximian.com
          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.


More information about the mono-bugs mailing list