Skip to content
Merged
Changes from 1 commit
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
2 changes: 1 addition & 1 deletion src/TraceEvent/ETWTraceEventSource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -879,7 +879,7 @@ protected override void Dispose(bool disposing)
{
foreach (TraceEventNativeMethods.SafeTraceHandle handle in handles)
{
handle.Dispose();
handle?.Dispose();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Should you also check if the handle is valid? Is this a standard SafeHandle? If so, calling Dispose on an invalid handle can throw.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yes, that's a good idea. Updated.

}

handles = null;
Expand Down