Skip to content
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

Don't throw in logging when the document path contains curly braces #61524

Merged
merged 1 commit into from
May 26, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,13 @@ public void Dispose()
}

public void TraceInformation(string message)
=> _traceSource.TraceInformation(message);
{
// Explicitly call TraceEvent here instead of TraceInformation.
// TraceInformation indirectly calls string.Format which throws if the message
// has unescaped curlies in it (can be a part of a URI for example).
// Since we have no need to call string.Format here, we don't.
_traceSource.TraceEvent(TraceEventType.Information, id: 0, message);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add a test?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jasonmalinowski I tried - but I couldn't get it to repro in our unit tests. It only repro'd under the debugger in VS. It might have something to do with the version of .netframework we're running in our tests

}

public void TraceWarning(string message)
=> _traceSource.TraceEvent(TraceEventType.Warning, id: 0, message);
Expand Down