Skip to content

ColoredConsoleAppender writes UTF-8 preamble to the console on initialization #168

@RoboBurned

Description

@RoboBurned

I have an issue with ColoredConsoleAppender on WIndows 10.
After initialization it prints an extra "space" to the console at the very beginning.
It writes the preamble of UTF-8 encoding that results in a visual "space" in windows console.

After debugging I found that it happens in ActivateOptions function when setting AutoFlush property of StreamWriter to true.

m_consoleOutputWriter.AutoFlush = true;

If you look at sources of Console.WriteLine method, they set HaveWrittenPreamble property to true to bypass writing it by streamwriter. That's why they have no such issue.
https://referencesource.microsoft.com/#mscorlib/system/console.cs,373

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions