[Mono-bugs] [Bug 540051] New: Bug in CSharpCodeGenerator.cs/PrivateImplementationType output

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Thu Sep 17 15:40:06 EDT 2009


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


           Summary: Bug in
                    CSharpCodeGenerator.cs/PrivateImplementationType
                    output
    Classification: Mono
           Product: Mono: Class Libraries
           Version: SVN
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: System
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: mkrueger at novell.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---


PrivateImplementationType is always printed as string instead of using a type
output (GetTypeOutput method should do the job).

That produces wrong output when the PrivateImplementationType is a generic type

See the example:

using Microsoft.CSharp;
using System;
using System.CodeDom;
using System.CodeDom.Compiler;
using System.IO;

class Program
{
    static void Main (string[] args)
    {
        StreamWriter sw = new StreamWriter (Console.OpenStandardOutput ());
        ICodeGenerator codeGenerator = new CSharpCodeProvider
().CreateGenerator (sw);
        CodeGeneratorOptions options = new CodeGeneratorOptions ();

        CodeTypeDeclaration cls = new CodeTypeDeclaration ();
        cls.Name = "Sample";

        CodeMemberProperty property = new CodeMemberProperty ();
        property.Name = "MyName";
        property.Type = new CodeTypeReference ("System.String");
        property.PrivateImplementationType = new CodeTypeReference
("MyInterface", new CodeTypeReference ("GenArg1"), new CodeTypeReference
("GenArg2"));
        cls.Members.Add (property);

        CodeNamespace ns = new CodeNamespace ("SampleNamespace");
        ns.Types.Add (cls);
        codeGenerator.GenerateCodeFromNamespace (ns, sw, options);

        sw.Close ();
    }
}

-------------
This outputs:
namespace SampleNamespace {
    public class Sample {
        string MyInterface`2.MyName {
        }
    }
}

The property should output as:
string MyInterface<GenArg1, GenArg2>.MyName {
}

-- 
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