Linebreak issue with clr strings manipulated by Ruby code

Hi, guys. Sorry if I am posting this in the wrong place, but I need
some kind of direction here.

I isolated my problem in the following UnitTest in Visual Basic:

Public Sub LineBreakProblem()
Const SCRIPT = “print System::String.Format(‘Line1{0}Line2’,

Dim engine = IronRuby.Ruby.CreateEngine()
Dim stream = New IO.MemoryStream
Dim writer = New IO.StreamWriter(stream)
engine.Runtime.IO.SetOutput(stream, writer)
Dim source = engine.CreateScriptSourceFromString(SCRIPT, "Script",


stream.Position = 0
Dim actual = (New IO.StreamReader(stream)).ReadToEnd()

Dim expected = String.Format("Line1{0}Line2", Environment.NewLine)

Assert.AreEqual(expected, actual)

End Sub

As you can see, i am running this Ruby code:

print System::String.Format(‘Line1{0}Line2’,

And then I am using the engine.Runtime.IO.SetOutput to get back the
result generated by the “print” statement. System.Environment.NewLine
returns the char combination CR + LF.

The “expected” variable will contain: “Line1” + CR + LF + “Line2”.
The “actual” variable receive the value “Line1” + CR + LF + CR + LF +

Seems that all the linebreaks are doubled when using the CLR string
with the “print” statement.

Any suggestion that you can give me to resolve or work around this
problem will be much appreciated.

Hi, sorry again, but is anyone seeing this message?

I coudnt get any response about this, either here or in the Codeplex
issue tracker.

2011/2/25 Aldinei S. [email protected]:

Yes, I can reproduce this. I’ll look into it. Have you opened a bug?
I’ll follow up there.

On Thu, Mar 3, 2011 at 6:11 PM, Aldinei S.

Yes, i created the issue #5836.

Thank you very much.

2011/3/4 Jimmy S. [email protected]: