[Mono-bugs] [Bug 542043] New: Long extension method names are not resolved with "protection level" error

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Thu Sep 24 19:39:37 EDT 2009


http://bugzilla.novell.com/show_bug.cgi?id=542043


           Summary: Long extension method names are not resolved with
                    "protection level" error
    Classification: Mono
           Product: Mono: Compilers
           Version: 2.4.x
          Platform: i686
        OS/Version: Windows
            Status: NEW
          Severity: Major
          Priority: P5 - None
         Component: C#
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: naasking at gmail.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---


User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.3)
Gecko/20090824 Firefox/3.5.3 (.NET CLR 3.5.30729)

The following code fails to compile:

public static class MessageFails
{
    public static MailMessage ParseMailMessage(this string raw)
    {
        var email = new MailMessage();

    // error CS0122: `System.Net.Mail.MailMessage.ContentTransferEncoding' 
        // is inaccessible due to its protection level
        var transferEncoding = email.ContentTransferEncoding();
        return email;
    }

    public static TransferEncoding ContentTransferEncoding(this MailMessage
email)
    {
        throw new NotSupportedException();
    }
}

However, if the extension method name is shortened, it resolves just fine:

public static class MessageWorks
{
    public static MailMessage ParseMailMessage(this string raw)
    {
        var email = new MailMessage();
        var transferEncoding = email.ContentTransfer();
        return email;
    }

    public static TransferEncoding ContentTransfer(this MailMessage email)
    {
        throw new NotSupportedException();
    }
}

Reproducible: Always

Steps to Reproduce:
1.
2.
3.
Actual Results:  
error CS0122

Expected Results:  
Compilation succeeds.

-- 
Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the mono-bugs mailing list