Skip to content

Commit a55e903

Browse files
sywhanggewarren
andauthored
Add remarks about EventSource.GetGuid (dotnet#5209)
* Add remarks about EventSource.GetGuid returning different value from EventSource.Guid property * fix build warnings' * PR feedback * fix incorrect xref * apply PR feedback * Apply suggestions from code review Co-authored-by: Genevieve Warren <[email protected]> * Update xml/System.Diagnostics.Tracing/EventSource.xml Co-authored-by: Genevieve Warren <[email protected]> * more code review feedback Co-authored-by: Genevieve Warren <[email protected]>
1 parent ff8ace9 commit a55e903

File tree

1 file changed

+30
-8
lines changed

1 file changed

+30
-8
lines changed

xml/System.Diagnostics.Tracing/EventSource.xml

Lines changed: 30 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,15 @@
241241
<Docs>
242242
<param name="eventSourceName">The name to apply to the event source. Must not be <see langword="null" />.</param>
243243
<summary>Creates a new instance of the <see cref="T:System.Diagnostics.Tracing.EventSource" /> class with the specified name.</summary>
244-
<remarks>To be added.</remarks>
244+
<remarks>
245+
<format type="text/markdown"><![CDATA[
246+
## Remarks
247+
248+
When using this constructor, ensure that the `eventSourceName` argument matches the ETW name defined by the <xref:System.Diagnostics.Tracing.EventSourceAttribute> attribute on that type. Otherwise, the GUIDs returned by the <xref:System.Diagnostics.Tracing.EventSource.Guid> property and the <xref:System.Diagnostics.Tracing.EventSource.GetGuid(System.Type)> method will be different. If the event source names differ, the <xref:System.Diagnostics.Tracing.EventSource.Guid> property returns the GUID used to register this EventSource with ETW.
249+
250+
251+
]]></format>
252+
</remarks>
245253
<exception cref="T:System.ArgumentNullException">
246254
<paramref name="eventSourceName" /> is <see langword="null" />.</exception>
247255
</Docs>
@@ -295,8 +303,8 @@
295303
## Remarks
296304
Traits provide additional information for an event and are interpreted by an event listener. Traits are specified as key-value pairs and if not specified in pairs, an exception will occur. You can retrieve a trait by passing the key to the <xref:System.Diagnostics.Tracing.EventSource.GetTrait%2A>, method.
297305
298-
Specifying `settings` when the <xref:System.Diagnostics.Tracing.EventSource> is constructed enables you to specify whether the event is written in a manifest-based or a self-describing format. In addition, you can specify that an exception should be raised when an error occurs during the event-writing process.
299-
306+
Specifying `settings` when the <xref:System.Diagnostics.Tracing.EventSource> is constructed enables you to specify whether the event is written in a manifest-based or a self-describing format. In addition, you can specify that an exception should be raised when an error occurs during the event-writing process.
307+
300308
]]></format>
301309
</remarks>
302310
<exception cref="T:System.ArgumentException">
@@ -343,8 +351,12 @@
343351
<format type="text/markdown"><![CDATA[
344352
345353
## Remarks
346-
Specifying `settings` when the <xref:System.Diagnostics.Tracing.EventSource> is constructed enables you to specify whether the event is written in a manifest-based or a self-describing format. In addition, you can specify that an exception should be raised when an error occurs during the event-writing process.
347-
354+
Specifying `settings` when the <xref:System.Diagnostics.Tracing.EventSource> is constructed enables you to specify whether the event is written in a manifest-based or a self-describing format. In addition, you can specify that an exception should be raised when an error occurs during the event-writing process.
355+
356+
When using this constructor, ensure that the `eventSourceName` argument matches the ETW name defined by the <xref:System.Diagnostics.Tracing.EventSourceAttribute> attribute on that type. Otherwise, the GUIDs returned by the <xref:System.Diagnostics.Tracing.EventSource.Guid> property and the <xref:System.Diagnostics.Tracing.EventSource.GetGuid(System.Type)> method will be different.
357+
358+
In such cases, the <xref:System.Diagnostics.Tracing.EventSource.Guid> property returns the GUID used to register this EventSource with ETW.
359+
348360
]]></format>
349361
</remarks>
350362
<exception cref="T:System.ArgumentNullException">
@@ -402,8 +414,11 @@
402414
## Remarks
403415
Traits provide additional information for an event and are interpreted by an event listener. Traits are specified as key-value pairs and if not specified in pairs, an exception will occur. You can retrieve a trait by passing the key to the <xref:System.Diagnostics.Tracing.EventSource.GetTrait%2A>, method.
404416
405-
Specifying `config` when the <xref:System.Diagnostics.Tracing.EventSource> is constructed enables you to specify whether the event is written in a manifest-based or a self-describing format. In addition, you can specify that an exception should be raised when an error occurs during the event-writing process.
406-
417+
Specifying `config` when the <xref:System.Diagnostics.Tracing.EventSource> is constructed enables you to specify whether the event is written in a manifest-based or a self-describing format. In addition, you can specify that an exception should be raised when an error occurs during the event-writing process.
418+
419+
When using this constructor, ensure that the `eventSourceName` argument matches the ETW name defined by the <xref:System.Diagnostics.Tracing.EventSourceAttribute> attribute on that type. Otherwise, the GUIDs returned by the <xref:System.Diagnostics.Tracing.EventSource.Guid> property and the <xref:System.Diagnostics.Tracing.EventSource.GetGuid(System.Type)> method will be different.
420+
421+
In such cases, the GUID used to register this EventSource with ETW is the one returned by <xref:System.Diagnostics.Tracing.EventSource.Guid>.
407422
]]></format>
408423
</remarks>
409424
<exception cref="T:System.ArgumentNullException">
@@ -863,7 +878,14 @@
863878
<param name="eventSourceType">The type of the event source.</param>
864879
<summary>Gets the unique identifier for this implementation of the event source.</summary>
865880
<returns>A unique identifier for this event source type.</returns>
866-
<remarks>To be added.</remarks>
881+
<remarks>
882+
<format type="text/markdown"><![CDATA[
883+
## Remarks
884+
If the name of the <xref:System.Diagnostics.Tracing.EventSource> that was passed to the constructor isn't specified as an <xref:System.Diagnostics.Tracing.EventSourceAttribute>, this method can return a different GUID to the one returned by the <xref:System.Diagnostics.Tracing.EventSource.Guid> property.
885+
886+
In such cases, the GUID that is used to register the <xref:System.Diagnostics.Tracing.EventSource> is the one returned by <xref:System.Diagnostics.Tracing.EventSource.Guid> property.
887+
]]>]</format>
888+
</remarks>
867889
</Docs>
868890
</Member>
869891
<Member MemberName="GetName">

0 commit comments

Comments
 (0)