diff options
author | Marek Safar <marek.safar@gmail.com> | 2018-09-19 15:19:22 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-09-19 15:19:22 +0300 |
commit | efd29b5cf854679349066e22ef9038b8cfe76d94 (patch) | |
tree | 2de750c1ac8a487d7f6d149592a6362ade6a5a77 /src/System.Private.CoreLib/shared/System/Diagnostics/Tracing/TraceLogging/TraceLoggingMetadataCollector.cs | |
parent | f9124d69e41d42196510dd7234b2d53fed48ad4c (diff) | |
parent | 49f9ed0e66fc2d4cd682821396c6af5e80182048 (diff) |
Merge pull request #25 from ntherning/bump-corert
Bump to latest upstream
Diffstat (limited to 'src/System.Private.CoreLib/shared/System/Diagnostics/Tracing/TraceLogging/TraceLoggingMetadataCollector.cs')
-rw-r--r-- | src/System.Private.CoreLib/shared/System/Diagnostics/Tracing/TraceLogging/TraceLoggingMetadataCollector.cs | 31 |
1 files changed, 26 insertions, 5 deletions
diff --git a/src/System.Private.CoreLib/shared/System/Diagnostics/Tracing/TraceLogging/TraceLoggingMetadataCollector.cs b/src/System.Private.CoreLib/shared/System/Diagnostics/Tracing/TraceLogging/TraceLoggingMetadataCollector.cs index 1db1a28c9..b5b199dbc 100644 --- a/src/System.Private.CoreLib/shared/System/Diagnostics/Tracing/TraceLogging/TraceLoggingMetadataCollector.cs +++ b/src/System.Private.CoreLib/shared/System/Diagnostics/Tracing/TraceLogging/TraceLoggingMetadataCollector.cs @@ -192,22 +192,43 @@ namespace System.Diagnostics.Tracing } /// <summary> + /// Adds a null-terminated string field to an event. + /// Compatible with core types: Utf16String, MbcsString. + /// Compatible with dataCollector method: AddNullTerminatedString(string). + /// </summary> + /// <param name="name"> + /// The name to use for the added field. This value must not be null. + /// </param> + /// <param name="type"> + /// The type code for the added field. This must be a null-terminated string type. + /// </param> + public void AddNullTerminatedString(string name, TraceLoggingDataType type) + { + switch ((TraceLoggingDataType)((int)type & Statics.InTypeMask)) + { + case TraceLoggingDataType.Utf16String: + break; + default: + throw new ArgumentOutOfRangeException(nameof(type)); + } + + this.impl.AddNonscalar(); + this.AddField(new FieldMetadata(name, type, this.Tags, this.BeginningBufferedArray)); + } + + /// <summary> /// Adds an array field to an event. /// </summary> /// <param name="name"> /// The name to use for the added field. This value must not be null. /// </param> /// <param name="type"> - /// The type code for the added field. This must be a fixed-size type - /// or a string type. In the case of a string type, this adds an array - /// of characters, not an array of strings. + /// The type code for the added field. This must be a fixed-size type. /// </param> public void AddArray(string name, TraceLoggingDataType type) { switch ((TraceLoggingDataType)((int)type & Statics.InTypeMask)) { - case TraceLoggingDataType.Utf16String: - case TraceLoggingDataType.MbcsString: case TraceLoggingDataType.Int8: case TraceLoggingDataType.UInt8: case TraceLoggingDataType.Int16: |