-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Console.Write prints a new line on iOS #36440
Comments
Tagging subscribers to this area: @eiriktsarpalis |
cc: @EgorBo |
I forgot to file an issue for that because wanted to unblock Console for both Android (it has the same issue obviously) and iOS to print at least something for tests/development purposes. |
I've added 5.0.0 milestone as there is a PR (#37078) that should solve this issue. |
This also means that WriteLines might be split up. Example output:
The correct output is:
This is because the call to WriteLine might be composed of multiple calls to Write:
This is quite annoying when reading logs. @steveisok any idea when this could be fixed? |
@rolfbjarne this will be addressed before RC. |
Is using NSLog important on iOS or can we use |
Yes, using NSLog is important, because iOS will close stderr/stdout, and the output is lost. NSLog however will still work, and app users can get that output and show it to app developers if required to debug a particularly complicated issue. |
Example:
Output with .NET 5:
Output with current Xamarin.iOS:
The problem seems to be that mono's implementation stores text until a newline is written:
https://github.com/mono/mono/blob/f24a85069b3541ef45c8bbbd800ec7d88ad22e07/mcs/class/corlib/System/Console.iOS.cs#L81-L83
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
and NSLog will append a newline if the text doesn't have one.
The text was updated successfully, but these errors were encountered: