-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Closed
Description
Example:
Console.Write ("A");
Console.Write ("B");
Console.WriteLine ("C");
Output with .NET 5:
2020-05-14 12:50:56.386845+0200 MySingleView[89908:5086139] A
2020-05-14 12:50:56.386961+0200 MySingleView[89908:5086139] B
2020-05-14 12:50:56.387585+0200 MySingleView[89908:5086139] C
Output with current Xamarin.iOS:
2020-05-14 12:53:03.497594+0200 testapp[93230:5096504] ABC
The problem seems to be that mono's implementation stores text until a newline is written:
while dotnet's implementation writes out the text every time:
runtime/src/libraries/System.Console/src/System/ConsolePal.iOS.cs
Lines 16 to 24 in 622341e
public override unsafe void Write(byte[] buffer, int offset, int count) | |
{ | |
ValidateWrite(buffer, offset, count); | |
fixed (byte* ptr = buffer) | |
{ | |
Interop.Sys.Log(ptr + offset, count); | |
} | |
} |
and NSLog will append a newline if the text doesn't have one.