-
Notifications
You must be signed in to change notification settings - Fork 152
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1040 from AArnott/fix1038
Fix ETW logging of named arguments in System.Text.Json formatter
- Loading branch information
Showing
6 changed files
with
72 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT license. See LICENSE file in the project root for full license information. | ||
|
||
namespace StreamJsonRpc; | ||
|
||
/// <summary> | ||
/// Utilities that are source-shared between the library and its tests. | ||
/// </summary> | ||
internal static class SharedUtilities | ||
{ | ||
/// <summary> | ||
/// The various modes that can be used to test the <see cref="JsonRpcEventSource"/> class. | ||
/// </summary> | ||
internal enum EventSourceTestMode | ||
{ | ||
/// <summary> | ||
/// ETW events are not forced on. | ||
/// </summary> | ||
None, | ||
|
||
/// <summary> | ||
/// ETW events are forced on and exceptions are swallowed as they would be in production. | ||
/// </summary> | ||
EmulateProduction, | ||
|
||
/// <summary> | ||
/// ETW events are forced on and exceptions are not swallowed, allowing tests to detect errors in ETW logging. | ||
/// </summary> | ||
DoNotSwallowExceptions, | ||
} | ||
|
||
internal static EventSourceTestMode GetEventSourceTestMode() => Environment.GetEnvironmentVariable("StreamJsonRpc_TestWithEventSource") switch | ||
{ | ||
"1" => EventSourceTestMode.EmulateProduction, | ||
"2" => EventSourceTestMode.DoNotSwallowExceptions, | ||
_ => EventSourceTestMode.None, | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters