[Mono-bugs] [Bug 692782] New: CSharpCodeProvider.CompileAssemblyFromDom produces non-compilable code when generic type arguments are involved

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Tue May 10 03:18:36 EDT 2011


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

https://bugzilla.novell.com/show_bug.cgi?id=692782#c0


           Summary: CSharpCodeProvider.CompileAssemblyFromDom produces
                    non-compilable code when generic type arguments are
                    involved
    Classification: Mono
           Product: Mono: Runtime
           Version: 2.10.x
          Platform: 64bit
        OS/Version: Ubuntu
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: misc
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: alex_syd1 at yahoo.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---
           Blocker: ---


Created an attachment (id=428771)
 --> (http://bugzilla.novell.com/attachment.cgi?id=428771)
The code to reproduce the bug, and two generated files.

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.16)
Gecko/20110319 Firefox/3.6.16 ( .NET CLR 3.5.30729; .NET4.0E)

When dynamically generating C# code with
CSharpCodeProvider.CompileAssemblyFromDom(), the resulting code is invalid if
generic type arguments are involved. Specifically, the following line
    ClassB<TType>.FuncB();
is generated as 
    ClassB.FuncB();

This produces a compiler error.

Reproducible: Always

Steps to Reproduce:
1. In VS2008 build a solution containing Program.cs from the attached file.
2. Run the executable in Windows 7.
3. Run the executable in Ubuntu with Mono 2.10, e.g. mono ca1.exe. Don't
recompile in Mono, just use the binary produced by VS compiler.

Actual Results:  
In case of Mono, the generated code is invalid (does not contain generic type
arguments in <>) and triggers a compiler error. Please see the attached file
generated-Mono.cs.

Expected Results:  
In case of VS2008, the generated code is correct.

The .cs files generated by Mono and VS2008 are also attached.
I have just raised Bug 692779 from the same area. We had to introduce ugly and
shaky hacks to keep the situation under control.

-- 
Configure bugmail: https://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