-
Notifications
You must be signed in to change notification settings - Fork 356
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
making TextWriterTraceAdapter synchronized #1043
Conversation
|
||
public override void Write(char value) | ||
{ | ||
// buffer all output | ||
_text.Append(value); | ||
|
||
int len = _text.Length; | ||
if (len > 2 && _text[len - 2] == '\r' && _text[len - 1] == '\n') | ||
if (len >= 2 && _text[len - 2] == '\r' && _text[len - 1] == '\n') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you explain this change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In my test, I just log WriteLine(string.Empty) -- which looks like it just sends '\r\n'. In that case, the string length was only 2, so this logic didn't kick in like I would have expected. Instead, it waited until it had '\r\n\r\n' before flushing. It's a minor change -- but I thought it made sense.
TextWriter adapter = TextWriterTraceAdapter.Synchronized(trace); | ||
|
||
// Start Tasks to write | ||
List<Task> tasks = new List<Task>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did this test repro the problem reliably?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, every time.
Addresses #1042