[Mono-bugs] [Bug 549472] New: CodeDOM produces unwanted newlines in C#output

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Fri Oct 23 03:29:03 EDT 2009


           Summary: CodeDOM produces unwanted newlines in C#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: ---

Currently the C# codedom output can produce following:

namespace Test

    public class NewClass

        public NewClass ()

That is because too many new lines are generated especially when
'BlankLinesBetweenMembers' is set.


Don't output a blank line for the first member.


protected new void GenerateTypes (CodeNamespace e)
    bool isFirst = true;
    foreach (CodeTypeDeclaration type in e.Types) {
        if (isFirst) {
            isFirst = false;
        } else {
            if (Options.BlankLinesBetweenMembers)
                Output.WriteLine ();
        GenerateType (type);

Some things that we changed for mono develop:

Method GenerateTypes (as above)
Method GenerateType (almost the same as above but for the members instead of
the types - but the same pattern)

In GenerateNamespaceStart the OutputStartBrace doesn't need a new line after
the start brace (thats why we have two new lines after the namespace). Our

Break down "OutputStartBrace" into two methods:
private void OutputStartBrace ()
    OutputStartBrace (true);

private void OutputStartBrace (bool appendNewLine)
    if (Options.BracingStyle == "C") {
        Output.WriteLine ("");
        Output.Write ("{");
    } else {
        Output.Write (" {");
    if (appendNewLine)
        Output.WriteLine ();
And use 'OutputStartBrace (false);' in the GenerateNamespaceStart method.

This bug in conjunction with 'Bug 540051 - Bug in
CSharpCodeGenerator.cs/PrivateImplementationType output' is a real show stopper
for monodevelop to use the CodeDOM output from mono.

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