Modernize System.Diagnostics C# snippets - #13028
Open
gewarren wants to merge 5 commits into
Open
Conversation
Update the first 60 System.Diagnostics samples and the SymbolStore sample to current C# patterns, and add or consolidate net10.0 snippet projects so each affected directory builds independently. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 81f0fa5e-3bcf-4d3b-b652-f7dc76e7ae03
Contributor
There was a problem hiding this comment.
Pull request overview
Modernizes the first 60 System.Diagnostics C# snippets and the related SymbolStore sample for current .NET 10 projects.
Changes:
- Updates C# syntax, formatting, disposal, and type usage.
- Adds or consolidates executable projects and shared entry points.
- Migrates the SymbolStore sample to
PersistedAssemblyBuilder.
Reviewed changes
Copilot reviewed 94 out of 96 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Review result |
|---|---|
snippets/csharp/System.Diagnostics/EventLog/MachineName/source.cs |
No final comment. |
snippets/csharp/System.Diagnostics/EventLog/Log/source.cs |
No final comment. |
snippets/csharp/System.Diagnostics/EventLog/GetEventLogs/source1.cs |
No final comment. |
snippets/csharp/System.Diagnostics/EventLog/GetEventLogs/source.cs |
No final comment. |
snippets/csharp/System.Diagnostics/EventLog/GetEventLogs/Project.csproj |
No final comment. |
snippets/csharp/System.Diagnostics/EventLog/GetEventLogs/Program.cs |
No final comment. |
snippets/csharp/System.Diagnostics/EventLog/Exists/Project.csproj |
No final comment. |
snippets/csharp/System.Diagnostics/EventLog/Exists/eventlog_exists_1.cs |
No final comment. |
snippets/csharp/System.Diagnostics/EventLog/EntryWritten/source.cs |
No final comment. |
snippets/csharp/System.Diagnostics/EventLog/Entries/source.cs |
No final comment. |
snippets/csharp/System.Diagnostics/EventLog/EnableRaisingEvents/source.cs |
No final comment. |
snippets/csharp/System.Diagnostics/EventLog/Delete/source1.cs |
No final comment. |
snippets/csharp/System.Diagnostics/EventLog/Delete/source.cs |
No final comment. |
snippets/csharp/System.Diagnostics/EventLog/Delete/Project.csproj |
No final comment. |
snippets/csharp/System.Diagnostics/EventLog/Delete/Program.cs |
No final comment. |
snippets/csharp/System.Diagnostics/EventLog/CreateEventSource/source.cs |
No final comment. |
snippets/csharp/System.Diagnostics/EventLog/CreateEventSource/Project.csproj |
No final comment. |
snippets/csharp/System.Diagnostics/EventLog/Clear/source.cs |
No final comment. |
snippets/csharp/System.Diagnostics/EventLog/.ctor/source2.cs |
No final comment. |
snippets/csharp/System.Diagnostics/EventLog/.ctor/source1.cs |
No final comment. |
snippets/csharp/System.Diagnostics/EventLog/.ctor/source.cs |
No final comment. |
snippets/csharp/System.Diagnostics/EventLog/.ctor/Project.csproj |
No final comment. |
snippets/csharp/System.Diagnostics/EventLog/.ctor/Program.cs |
No final comment. |
snippets/csharp/System.Diagnostics/EventInstance/Overview/source.cs |
No final comment. |
snippets/csharp/System.Diagnostics/EventInstance/Overview/Project.csproj |
No final comment. |
snippets/csharp/System.Diagnostics/EntryWrittenEventArgs/Overview/Project.csproj |
No final comment. |
snippets/csharp/System.Diagnostics/EntryWrittenEventArgs/Overview/entrywritteneventargs_ctor1.cs |
No final comment. |
snippets/csharp/System.Diagnostics/EntryWrittenEventArgs/.ctor/Project.csproj |
No final comment. |
snippets/csharp/System.Diagnostics/EntryWrittenEventArgs/.ctor/entrywritteneventargs_ctor2.cs |
No final comment. |
snippets/csharp/System.Diagnostics/DefaultTraceListener/Write/Project.csproj |
No final comment. |
snippets/csharp/System.Diagnostics/DefaultTraceListener/Write/defaulttracelistener.cs |
No final comment. |
snippets/csharp/System.Diagnostics/DefaultTraceListener/Overview/Project.csproj |
No final comment. |
snippets/csharp/System.Diagnostics/DefaultTraceListener/Overview/binomial.cs |
No final comment. |
snippets/csharp/System.Diagnostics/DebuggerBrowsableAttribute/.ctor/Project.csproj |
No final comment. |
snippets/csharp/System.Diagnostics/DebuggerBrowsableAttribute/.ctor/program.cs |
No final comment. |
snippets/csharp/System.Diagnostics/Debug/WriteLineIf/source3.cs |
No final comment. |
snippets/csharp/System.Diagnostics/Debug/WriteLineIf/source2.cs |
No final comment. |
snippets/csharp/System.Diagnostics/Debug/WriteLineIf/source1.cs |
No final comment. |
snippets/csharp/System.Diagnostics/Debug/WriteLineIf/source.cs |
No final comment. |
snippets/csharp/System.Diagnostics/Debug/WriteLineIf/Project.csproj |
No final comment. |
snippets/csharp/System.Diagnostics/Debug/WriteLine/source3.cs |
No final comment. |
snippets/csharp/System.Diagnostics/Debug/WriteLine/source2.cs |
No final comment. |
snippets/csharp/System.Diagnostics/Debug/WriteLine/source1.cs |
No final comment. |
snippets/csharp/System.Diagnostics/Debug/WriteLine/source.cs |
No final comment. |
snippets/csharp/System.Diagnostics/Debug/WriteLine/Project.csproj |
No final comment. |
snippets/csharp/System.Diagnostics/Debug/WriteIf/source3.cs |
No final comment. |
snippets/csharp/System.Diagnostics/Debug/WriteIf/source2.cs |
No final comment. |
snippets/csharp/System.Diagnostics/Debug/WriteIf/source1.cs |
No final comment. |
snippets/csharp/System.Diagnostics/Debug/WriteIf/source.cs |
No final comment. |
snippets/csharp/System.Diagnostics/Debug/WriteIf/Project.csproj |
No final comment. |
snippets/csharp/System.Diagnostics/Debug/Write/source.cs |
No final comment. |
snippets/csharp/System.Diagnostics/Debug/Overview/source.cs |
No final comment. |
snippets/csharp/System.Diagnostics/Debug/Indent/source.cs |
No final comment. |
snippets/csharp/System.Diagnostics/Debug/Fail/source1.cs |
No final comment. |
snippets/csharp/System.Diagnostics/Debug/Fail/source.cs |
No final comment. |
snippets/csharp/System.Diagnostics/Debug/Fail/Project.csproj |
No final comment. |
snippets/csharp/System.Diagnostics/Debug/Close/source.cs |
No final comment. |
snippets/csharp/System.Diagnostics/Debug/Assert/source2.cs |
No final comment. |
snippets/csharp/System.Diagnostics/Debug/Assert/source1.cs |
No final comment. |
snippets/csharp/System.Diagnostics/Debug/Assert/source.cs |
No final comment. |
snippets/csharp/System.Diagnostics/DataReceivedEventArgs/Overview/sort_async.cs |
No final comment. |
snippets/csharp/System.Diagnostics/DataReceivedEventArgs/Overview/Project.csproj |
No final comment. |
snippets/csharp/System.Diagnostics/DataReceivedEventArgs/Overview/Program.cs |
No final comment. |
snippets/csharp/System.Diagnostics/DataReceivedEventArgs/Overview/nmake_async.cs |
No final comment. |
snippets/csharp/System.Diagnostics/DataReceivedEventArgs/Overview/net_async.cs |
No final comment. |
snippets/csharp/System.Diagnostics/DataReceivedEventArgs/Overview/datareceivedevent.cs |
No final comment. |
snippets/csharp/System.Diagnostics/CounterSample/.ctor/Project.csproj |
No final comment. |
snippets/csharp/System.Diagnostics/CounterSample/.ctor/countersample_ctor_2.cs |
No final comment. |
snippets/csharp/System.Diagnostics/CounterCreationDataCollection/IndexOf/Project.csproj |
No final comment. |
snippets/csharp/System.Diagnostics/CounterCreationDataCollection/IndexOf/countercreationdatacollection_insert_indexof.cs |
No final comment. |
snippets/csharp/System.Diagnostics/CounterCreationDataCollection/Contains/Project.csproj |
No final comment. |
snippets/csharp/System.Diagnostics/CounterCreationDataCollection/Contains/countercreationdatacollection_contains.cs |
No final comment. |
snippets/csharp/System.Diagnostics/CounterCreationDataCollection/AddRange/Project.csproj |
No final comment. |
snippets/csharp/System.Diagnostics/CounterCreationDataCollection/AddRange/countercreationdatacollection_addrange.cs |
No final comment. |
snippets/csharp/System.Diagnostics/CounterCreationDataCollection/.ctor/Project.csproj |
No final comment. |
snippets/csharp/System.Diagnostics/CounterCreationDataCollection/.ctor/Program.cs |
No final comment. |
snippets/csharp/System.Diagnostics/CounterCreationDataCollection/.ctor/countercreationdatacollection_ctor.cs |
No final comment. |
snippets/csharp/System.Diagnostics/CounterCreationDataCollection/.ctor/countercreationdatacollection_ctor_countercreationdatacollection.cs |
No final comment. |
snippets/csharp/System.Diagnostics/CounterCreationData/Overview/Project.csproj |
No final comment. |
snippets/csharp/System.Diagnostics/CounterCreationData/Overview/averagecount32.cs |
No final comment. |
snippets/csharp/System.Diagnostics/CounterCreationData/.ctor/Project.csproj |
No final comment. |
snippets/csharp/System.Diagnostics/CounterCreationData/.ctor/diagnostics_countercreationdata.cs |
No final comment. |
snippets/csharp/System.Diagnostics/CorrelationManager/Overview/Project.csproj |
No final comment. |
snippets/csharp/System.Diagnostics/CorrelationManager/Overview/program.cs |
No final comment. |
snippets/csharp/System.Diagnostics/ConsoleTraceListener/Overview/Project.csproj |
No final comment. |
snippets/csharp/System.Diagnostics/ConsoleTraceListener/Overview/program.cs |
No final comment. |
snippets/csharp/System.Diagnostics/ConditionalAttribute/Overview/Project.csproj |
No final comment. |
snippets/csharp/System.Diagnostics/ConditionalAttribute/Overview/cas.cs |
Moderate issue (3 votes): retain the console trace listener setup before Debug.WriteLine and remove the replacement Console.WriteLine block. |
snippets/csharp/System.Diagnostics/BooleanSwitch/Overview/source.cs |
No final comment. |
snippets/csharp/System.Diagnostics/BooleanSwitch/Overview/remarks.cs |
No final comment. |
snippets/csharp/System.Diagnostics/BooleanSwitch/Overview/Project.csproj |
No final comment. |
snippets/csharp/System.Diagnostics/BooleanSwitch/Overview/Program.cs |
No final comment. |
snippets/csharp/System.Diagnostics/BooleanSwitch/Enabled/source.cs |
No final comment. |
snippets/csharp/System.Diagnostics/BooleanSwitch/Enabled/Project.csproj |
No final comment. |
snippets/csharp/System.Diagnostics.SymbolStore/ISymbolDocumentWriter/Overview/Project.csproj |
No final comment. |
snippets/csharp/System.Diagnostics.SymbolStore/ISymbolDocumentWriter/Overview/modulebuilder_definedocument.cs |
No final comment. |
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Co-authored-by: gewarren <24882762+gewarren@users.noreply.github.com>
Co-authored-by: gewarren <24882762+gewarren@users.noreply.github.com>
adegeo
approved these changes
Aug 25, 2026
…n-modernize-system-diagnostics
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Modernizes the first 60 C# snippets in the
System.Diagnosticsnamespace, plus the relatedSystem.Diagnostics.SymbolStoresample, so they use current C# syntax while preserving the APIs and behavior being demonstrated.Adds or consolidates .NET 10 snippet projects for the affected directories, including shared entry points where multiple samples compile together. All 39 affected
System.Diagnosticsprojects and the SymbolStore project build successfully.Internal previews
Toggle expand/collapse
Note
This table shows the first 50 preview links (sorted alphabetically by file path) found in the OPS build report. For the full list, select OpenPublishing.Build Details within checks.
Build report