Skip to content

Modernize remaining System.Diagnostics C# snippets - #13034

Open
gewarren wants to merge 7 commits into
mainfrom
gewarren-modernize-system-diagnostics-3
Open

Modernize remaining System.Diagnostics C# snippets#13034
gewarren wants to merge 7 commits into
mainfrom
gewarren-modernize-system-diagnostics-3

Conversation

@gewarren

@gewarren gewarren commented Aug 25, 2026

Copy link
Copy Markdown
Collaborator

Contributes to #12713.

Summary

Modernizes the final 95 C# snippets in the System.Diagnostics namespace so they use current C# syntax while preserving the documented APIs and runtime behavior.

Updates 58 snippet projects and adds eight consolidation entry points for directories containing multiple samples. All affected projects build successfully; remaining warnings are expected platform and obsolete-API annotations for the demonstrated APIs.


Internal previews

Toggle expand/collapse
File Preview link
snippets/csharp/System.Diagnostics/PerformanceCounterCategory/Overview/perfcountercatcreateexist.cs Learn preview
snippets/csharp/System.Diagnostics/PerformanceCounterType/Overview/averagetimer32.cs Learn preview
snippets/csharp/System.Diagnostics/PerformanceCounterType/Overview/numberofitems32.cs Learn preview
snippets/csharp/System.Diagnostics/PerformanceCounterType/Overview/numberofitems64.cs Learn preview
snippets/csharp/System.Diagnostics/PerformanceCounterType/Overview/program.cs Learn preview
snippets/csharp/System.Diagnostics/PerformanceCounterType/Overview/rateofcountspersecond32.cs Learn preview
snippets/csharp/System.Diagnostics/PerformanceCounterType/Overview/rateofcountspersecond64.cs Learn preview
snippets/csharp/System.Diagnostics/PerformanceCounterType/Overview/rawfraction.cs Learn preview
snippets/csharp/System.Diagnostics/Process/ArgsEcho/processstartstatic3.cs Learn preview
snippets/csharp/System.Diagnostics/Process/BasePriority/source.cs Learn preview
snippets/csharp/System.Diagnostics/Process/Close/process_refresh.cs Learn preview
snippets/csharp/System.Diagnostics/Process/EnableRaisingEvents/processexitedevent.cs Learn preview
snippets/csharp/System.Diagnostics/Process/GetCurrentProcess/processstaticget.cs Learn preview
snippets/csharp/System.Diagnostics/Process/Id/program.cs Learn preview
snippets/csharp/System.Diagnostics/Process/MachineName/process_getprocessesbyname2_2.cs Learn preview
snippets/csharp/System.Diagnostics/Process/MainWindowTitle/process_mainwindowtitle.cs Learn preview
snippets/csharp/System.Diagnostics/Process/OnExited/program.cs Learn preview
snippets/csharp/System.Diagnostics/Process/Overview/processstart.cs Learn preview
snippets/csharp/System.Diagnostics/Process/Overview/processstartstatic.cs Learn preview
snippets/csharp/System.Diagnostics/Process/Overview/processstartstatic2.cs Learn preview
snippets/csharp/System.Diagnostics/Process/StandardError/source.cs Learn preview
snippets/csharp/System.Diagnostics/Process/StandardError/stderror-sync.cs Learn preview
snippets/csharp/System.Diagnostics/Process/StandardInput/process_standardinput.cs Learn preview
snippets/csharp/System.Diagnostics/Process/StandardOutput/process_standardoutput.cs Learn preview
snippets/csharp/System.Diagnostics/Process/StandardOutput/stdoutput-async.cs Learn preview
snippets/csharp/System.Diagnostics/Process/StandardOutput/stdoutput-sync.cs Learn preview
snippets/csharp/System.Diagnostics/Process/Start/program.cs Learn preview
snippets/csharp/System.Diagnostics/Process/SynchronizingObject/process_synchronizingobject.cs Learn preview
snippets/csharp/System.Diagnostics/Process/SynchronizingObject/remarks.cs Learn preview
snippets/csharp/System.Diagnostics/Process/Write500Lines/write500lines.cs Learn preview
snippets/csharp/System.Diagnostics/ProcessModule/BaseAddress/processmodule_baseaddress.cs Learn preview
snippets/csharp/System.Diagnostics/ProcessModule/EntryPointAddress/processmodule_entrypoint.cs Learn preview
snippets/csharp/System.Diagnostics/ProcessModule/FileName/processmodule_filename.cs Learn preview
snippets/csharp/System.Diagnostics/ProcessModule/FileVersionInfo/processmodule_fileversioninfo.cs Learn preview
snippets/csharp/System.Diagnostics/ProcessModule/ModuleMemorySize/processmodule_modulememorysize.cs Learn preview
snippets/csharp/System.Diagnostics/ProcessModule/ModuleName/processmodule_modulename.cs Learn preview
snippets/csharp/System.Diagnostics/ProcessModule/Overview/processmodule.cs Learn preview
snippets/csharp/System.Diagnostics/ProcessModule/ToString/processmodule_tostring.cs Learn preview
snippets/csharp/System.Diagnostics/ProcessStartInfo/RedirectStandardOutput/stdstr.cs Learn preview
snippets/csharp/System.Diagnostics/ProcessStartInfo/Verb/source.cs Learn preview
snippets/csharp/System.Diagnostics/ProcessThread/IdealProcessor/program.cs Learn preview
snippets/csharp/System.Diagnostics/SourceFilter/.ctor/program.cs Learn preview
snippets/csharp/System.Diagnostics/StackFrame/GetMethod/stacktracesample3.cs Learn preview
snippets/csharp/System.Diagnostics/StackFrame/Overview/program.cs Learn preview
snippets/csharp/System.Diagnostics/StackFrame/Overview/source.cs Learn preview
snippets/csharp/System.Diagnostics/StackTrace/GetFrames/stacktracesample2.cs Learn preview
snippets/csharp/System.Diagnostics/StackTrace/Overview/stacktracesample1.cs Learn preview
snippets/csharp/System.Diagnostics/Stopwatch/Overview/source.cs Learn preview
snippets/csharp/System.Diagnostics/Stopwatch/Overview/source1.cs Learn preview
snippets/csharp/System.Diagnostics/Switch/Overview/source.cs Learn preview

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

Update the final 95 System.Diagnostics C# samples to current syntax and consolidate their net10.0 snippet projects while preserving documented APIs and runtime behavior.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 81f0fa5e-3bcf-4d3b-b652-f7dc76e7ae03
@gewarren
gewarren requested a review from a team as a code owner August 25, 2026 20:45
Copilot AI lite review requested due to automatic review settings August 25, 2026 20:45

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR modernizes the remaining C# snippet sources under snippets/csharp/System.Diagnostics to current C# syntax while keeping the documented APIs and observable behavior intact, and updates snippet projects to ensure the samples compile as runnable or consolidated entry points where needed.

Changes:

  • Modernizes snippet source code (target-typed new, built-in aliases, object/collection initializers, improved using patterns, minor formatting cleanups).
  • Updates/creates snippet project files (many LibraryExe / WinExe) and adds dispatcher Program.cs entry points for directories with multiple samples.
  • Removes unused using directives and updates sample scaffolding to keep projects building.

Reviewed changes

Copilot reviewed 159 out of 161 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
snippets/csharp/System.Diagnostics/XmlWriterTraceListener/Overview/Project.csproj Switch project to Exe for runnable sample.
snippets/csharp/System.Diagnostics/XmlWriterTraceListener/Overview/program.cs Modernize snippet code (target-typed new, using order).
snippets/csharp/System.Diagnostics/TraceSwitch/TraceWarning/source.cs Modernize snippet; static field naming and brace usage.
snippets/csharp/System.Diagnostics/TraceSwitch/TraceWarning/Project.csproj Formatting cleanup.
snippets/csharp/System.Diagnostics/TraceSwitch/TraceInfo/source.cs Modernize snippet; static field naming and brace usage.
snippets/csharp/System.Diagnostics/TraceSwitch/TraceInfo/Project.csproj Formatting cleanup.
snippets/csharp/System.Diagnostics/TraceSwitch/Overview/source.cs Modernize snippet; convert entrypoint to Run.
snippets/csharp/System.Diagnostics/TraceSwitch/Overview/remarks.cs Modernize snippet; convert entrypoint to Run.
snippets/csharp/System.Diagnostics/TraceSwitch/Overview/Project.csproj Remove StartupObject for consolidated entrypoint.
snippets/csharp/System.Diagnostics/TraceSwitch/Overview/Program.cs Add dispatcher entrypoint for multiple samples.
snippets/csharp/System.Diagnostics/TraceSwitch/Level/source.cs Modernize snippet; static field naming and braces.
snippets/csharp/System.Diagnostics/TraceSwitch/Level/Project.csproj Formatting cleanup.
snippets/csharp/System.Diagnostics/TraceListenerCollection/Add/source.cs Use object initializer + explicit type.
snippets/csharp/System.Diagnostics/TraceListenerCollection/Add/Project.csproj Formatting cleanup.
snippets/csharp/System.Diagnostics/TraceListener/GetSupportedAttributes/Project.csproj Switch project to Exe for runnable sample.
snippets/csharp/System.Diagnostics/TraceListener/GetSupportedAttributes/program.cs Modernize snippet; collection expression and target-typed new.
snippets/csharp/System.Diagnostics/TraceFilter/ShouldTrace/source.cs Use object initializer + target-typed new.
snippets/csharp/System.Diagnostics/TraceFilter/ShouldTrace/Project.csproj Switch project to Exe for runnable sample.
snippets/csharp/System.Diagnostics/Trace/WriteLineIf/source.cs Modernize sample and rename type to avoid WinForms dependency.
snippets/csharp/System.Diagnostics/Trace/WriteLineIf/source1.cs Modernize sample and rename type to avoid WinForms dependency.
snippets/csharp/System.Diagnostics/Trace/WriteLineIf/source2.cs Modernize sample and rename type to avoid WinForms dependency.
snippets/csharp/System.Diagnostics/Trace/WriteLineIf/Project.csproj Add snippet project for compilation.
snippets/csharp/System.Diagnostics/Trace/WriteLine/source.cs Modernize sample and rename type to avoid WinForms dependency.
snippets/csharp/System.Diagnostics/Trace/WriteLine/source1.cs Modernize sample and rename type to avoid WinForms dependency.
snippets/csharp/System.Diagnostics/Trace/WriteLine/source2.cs Modernize sample and rename type to avoid WinForms dependency.
snippets/csharp/System.Diagnostics/Trace/WriteLine/Project.csproj Add snippet project for compilation.
snippets/csharp/System.Diagnostics/Trace/WriteIf/source.cs Modernize sample and rename type to avoid WinForms dependency.
snippets/csharp/System.Diagnostics/Trace/WriteIf/source1.cs Modernize sample and rename type to avoid WinForms dependency.
snippets/csharp/System.Diagnostics/Trace/WriteIf/source2.cs Modernize sample; string interpolation.
snippets/csharp/System.Diagnostics/Trace/WriteIf/source3.cs Modernize sample and rename type to avoid WinForms dependency.
snippets/csharp/System.Diagnostics/Trace/WriteIf/Project.csproj Add snippet project for compilation.
snippets/csharp/System.Diagnostics/Trace/Write/source.cs Modernize sample and rename type to avoid WinForms dependency.
snippets/csharp/System.Diagnostics/Trace/Write/source1.cs Modernize sample and rename type to avoid WinForms dependency.
snippets/csharp/System.Diagnostics/Trace/Write/source2.cs Modernize sample; string interpolation.
snippets/csharp/System.Diagnostics/Trace/Write/source3.cs Modernize sample and rename type to avoid WinForms dependency.
snippets/csharp/System.Diagnostics/Trace/Write/Project.csproj Add snippet project for compilation.
snippets/csharp/System.Diagnostics/Trace/Overview/source.cs Formatting/indentation normalization.
snippets/csharp/System.Diagnostics/Trace/Overview/Project.csproj Formatting cleanup.
snippets/csharp/System.Diagnostics/Trace/Listeners/source.cs Remove unused usings; explicit type + target-typed new.
snippets/csharp/System.Diagnostics/Trace/Listeners/Project.csproj Formatting cleanup.
snippets/csharp/System.Diagnostics/Trace/Indent/source.cs Remove unused usings.
snippets/csharp/System.Diagnostics/Trace/Indent/Project.csproj Formatting cleanup.
snippets/csharp/System.Diagnostics/Trace/Fail/source1.cs Modernize enum formatting and string interpolation.
snippets/csharp/System.Diagnostics/Trace/Fail/source.cs Modernize enum formatting and string interpolation; comment punctuation.
snippets/csharp/System.Diagnostics/Trace/Fail/Project.csproj Formatting cleanup.
snippets/csharp/System.Diagnostics/Trace/Close/source.cs Modernize using and target-typed new; using order.
snippets/csharp/System.Diagnostics/Trace/Close/Project.csproj Formatting cleanup.
snippets/csharp/System.Diagnostics/Trace/Assert/source2.cs Modernize null-check to pattern matching.
snippets/csharp/System.Diagnostics/Trace/Assert/source1.cs Modernize null-check to pattern matching.
snippets/csharp/System.Diagnostics/Trace/Assert/source.cs Modernize snippet and add scaffolding for compilation (but BOM lost).
snippets/csharp/System.Diagnostics/Trace/Assert/Project.csproj Formatting cleanup.
snippets/csharp/System.Diagnostics/TextWriterTraceListener/Writer/source.cs Modernize indentation and object initializer usage.
snippets/csharp/System.Diagnostics/TextWriterTraceListener/Writer/Project.csproj Formatting cleanup.
snippets/csharp/System.Diagnostics/TextWriterTraceListener/Write/source.cs Modernize indentation and object initializer usage.
snippets/csharp/System.Diagnostics/TextWriterTraceListener/Write/Project.csproj Formatting cleanup.
snippets/csharp/System.Diagnostics/TextWriterTraceListener/Overview/source.cs Modernize using + ensure listener removed before disposal.
snippets/csharp/System.Diagnostics/TextWriterTraceListener/Overview/Project.csproj Formatting cleanup.
snippets/csharp/System.Diagnostics/TextWriterTraceListener/.ctor/twtlconwritername.cs Modernize, rename const, change MainRun.
snippets/csharp/System.Diagnostics/TextWriterTraceListener/.ctor/twtlconstringname.cs Modernize, rename const, change MainRun.
snippets/csharp/System.Diagnostics/TextWriterTraceListener/.ctor/twtlconstring.cs Modernize, change MainRun.
snippets/csharp/System.Diagnostics/TextWriterTraceListener/.ctor/twtlconstreamname.cs Modernize, rename const, change MainRun.
snippets/csharp/System.Diagnostics/TextWriterTraceListener/.ctor/twtlconstream.cs Modernize, rename const, change MainRun.
snippets/csharp/System.Diagnostics/TextWriterTraceListener/.ctor/source1.cs Modernize object initializer; change MainRun.
snippets/csharp/System.Diagnostics/TextWriterTraceListener/.ctor/source.cs Modernize using/disposal and string interpolation; change MainRun.
snippets/csharp/System.Diagnostics/TextWriterTraceListener/.ctor/Project.csproj Remove StartupObject for consolidated entrypoint.
snippets/csharp/System.Diagnostics/TextWriterTraceListener/.ctor/Program.cs Add dispatcher entrypoint for multiple samples.
snippets/csharp/System.Diagnostics/SwitchAttribute/Overview/Project.csproj Switch project to Exe for runnable sample.
snippets/csharp/System.Diagnostics/SwitchAttribute/Overview/program.cs Modernize code (target-typed new, collection expression, interpolation).
snippets/csharp/System.Diagnostics/Switch/Overview/source.cs Modernize; change MainRun.
snippets/csharp/System.Diagnostics/Switch/Overview/remarks.cs Modernize; change MainRun.
snippets/csharp/System.Diagnostics/Switch/Overview/Project.csproj Remove StartupObject for consolidated entrypoint.
snippets/csharp/System.Diagnostics/Switch/Overview/Program.cs Add dispatcher entrypoint for multiple samples.
snippets/csharp/System.Diagnostics/Stopwatch/Overview/source1.cs Modernize; change entrypoint to Run.
snippets/csharp/System.Diagnostics/Stopwatch/Overview/source.cs Modernize aliases, spacing, and collections.
snippets/csharp/System.Diagnostics/Stopwatch/Overview/Project.csproj Switch project to Exe for runnable sample.
snippets/csharp/System.Diagnostics/Stopwatch/Overview/Program.cs Add dispatcher entrypoint for multiple samples.
snippets/csharp/System.Diagnostics/StackTrace/Overview/stacktracesample1.cs Modernize constructors, spacing, and exception rethrow.
snippets/csharp/System.Diagnostics/StackTrace/Overview/Project.csproj Switch project to Exe for runnable sample.
snippets/csharp/System.Diagnostics/StackTrace/GetFrames/stacktracesample2.cs Modernize formatting and array syntax.
snippets/csharp/System.Diagnostics/StackTrace/GetFrames/Project.csproj Switch project to Exe for runnable sample.
snippets/csharp/System.Diagnostics/StackFrame/Overview/source.cs Modernize formatting and exception rethrow patterns.
snippets/csharp/System.Diagnostics/StackFrame/Overview/Project.csproj Switch project to Exe for runnable sample.
snippets/csharp/System.Diagnostics/StackFrame/Overview/program.cs Modernize and add dispatcher entrypoint.
snippets/csharp/System.Diagnostics/StackFrame/GetMethod/stacktracesample3.cs Modernize constructors/spacing; keep EventLog behavior.
snippets/csharp/System.Diagnostics/StackFrame/GetMethod/Project.csproj Switch project to Exe and align package reference.
snippets/csharp/System.Diagnostics/SourceFilter/.ctor/Project.csproj Switch project to Exe and simplify TF.
snippets/csharp/System.Diagnostics/SourceFilter/.ctor/program.cs Modernize code (aliases, collection expressions, interpolation).
snippets/csharp/System.Diagnostics/ProcessThread/IdealProcessor/Project.csproj Switch project to Exe for runnable sample.
snippets/csharp/System.Diagnostics/ProcessThread/IdealProcessor/program.cs Modernize; add braces and nint cast.
snippets/csharp/System.Diagnostics/ProcessStartInfo/Verb/source.cs Modernize object initializers, loops, and using pattern.
snippets/csharp/System.Diagnostics/ProcessStartInfo/Verb/Project.csproj Switch to WinExe and remove unused package reference.
snippets/csharp/System.Diagnostics/ProcessStartInfo/RedirectStandardOutput/stdstr.cs Modernize using pattern (now has redundant block).
snippets/csharp/System.Diagnostics/ProcessStartInfo/RedirectStandardOutput/Project.csproj Switch project to Exe for runnable sample.
snippets/csharp/System.Diagnostics/ProcessModule/ToString/Project.csproj Switch project to Exe for runnable sample.
snippets/csharp/System.Diagnostics/ProcessModule/ToString/processmodule_tostring.cs Modernize using/new usage.
snippets/csharp/System.Diagnostics/ProcessModule/Overview/Project.csproj Switch project to Exe for runnable sample.
snippets/csharp/System.Diagnostics/ProcessModule/Overview/processmodule.cs Modernize using/new usage.
snippets/csharp/System.Diagnostics/ProcessModule/ModuleName/Project.csproj Switch project to Exe for runnable sample.
snippets/csharp/System.Diagnostics/ProcessModule/ModuleName/processmodule_modulename.cs Modernize using/new usage.
snippets/csharp/System.Diagnostics/ProcessModule/ModuleMemorySize/Project.csproj Switch project to Exe for runnable sample.
snippets/csharp/System.Diagnostics/ProcessModule/ModuleMemorySize/processmodule_modulememorysize.cs Modernize using/new usage.
snippets/csharp/System.Diagnostics/ProcessModule/FileVersionInfo/Project.csproj Switch project to Exe for runnable sample.
snippets/csharp/System.Diagnostics/ProcessModule/FileVersionInfo/processmodule_fileversioninfo.cs Modernize using/new usage.
snippets/csharp/System.Diagnostics/ProcessModule/FileName/Project.csproj Switch project to Exe for runnable sample.
snippets/csharp/System.Diagnostics/ProcessModule/FileName/processmodule_filename.cs Modernize using/new usage.
snippets/csharp/System.Diagnostics/ProcessModule/EntryPointAddress/Project.csproj Switch project to Exe for runnable sample.
snippets/csharp/System.Diagnostics/ProcessModule/EntryPointAddress/processmodule_entrypoint.cs Modernize using/new usage.
snippets/csharp/System.Diagnostics/ProcessModule/BaseAddress/Project.csproj Switch project to Exe for runnable sample.
snippets/csharp/System.Diagnostics/ProcessModule/BaseAddress/processmodule_baseaddress.cs Modernize using/new usage.
snippets/csharp/System.Diagnostics/Process/SynchronizingObject/remarks.cs Modernize; change MainRun for consolidation.
snippets/csharp/System.Diagnostics/Process/SynchronizingObject/Project.csproj Add WinForms snippet project file.
snippets/csharp/System.Diagnostics/Process/SynchronizingObject/Program.cs Add dispatcher entrypoint for multiple samples.
snippets/csharp/System.Diagnostics/Process/SynchronizingObject/process_synchronizingobject.cs Modernize WinForms sample; change MainRun.
snippets/csharp/System.Diagnostics/Process/Start/Project.csproj Switch project to Exe for runnable sample.
snippets/csharp/System.Diagnostics/Process/Start/program.cs Modernize usings and object creation.
snippets/csharp/System.Diagnostics/Process/StandardOutput/write500lines.cs Change MainRun and add braces for clarity.
snippets/csharp/System.Diagnostics/Process/StandardOutput/stdoutput-sync.cs Use SampleProcess helper to launch consolidated samples.
snippets/csharp/System.Diagnostics/Process/StandardOutput/stdoutput-async.cs Use SampleProcess helper to launch consolidated samples.
snippets/csharp/System.Diagnostics/Process/StandardOutput/Project.csproj Remove StartupObject for consolidated entrypoint.
snippets/csharp/System.Diagnostics/Process/StandardOutput/Program.cs Add dispatcher + SampleProcess helper.
snippets/csharp/System.Diagnostics/Process/StandardOutput/process_standardoutput.cs Change MainRun and modernize using.
snippets/csharp/System.Diagnostics/Process/StandardInput/Project.csproj Switch project to Exe for runnable sample.
snippets/csharp/System.Diagnostics/Process/StandardInput/process_standardinput.cs Modernize using and built-in aliases.
snippets/csharp/System.Diagnostics/Process/StandardError/stderror-sync.cs Change MainRun and use consolidated helper.
snippets/csharp/System.Diagnostics/Process/StandardError/source.cs Change MainRun and modernize ProcessStartInfo.
snippets/csharp/System.Diagnostics/Process/StandardError/Project.csproj Remove StartupObject for consolidated entrypoint.
snippets/csharp/System.Diagnostics/Process/StandardError/Program.cs Add dispatcher + helper implementation.
snippets/csharp/System.Diagnostics/Process/Overview/Project.csproj Add snippet project file for compilation.
snippets/csharp/System.Diagnostics/Process/Overview/Program.cs Add dispatcher + SampleProcess helper (BOM issue present in some related files).
snippets/csharp/System.Diagnostics/Process/Overview/processstartstatic3.cs Update helper sample; change MainRun (BOM lost).
snippets/csharp/System.Diagnostics/Process/Overview/processstartstatic2.cs Update sample to use consolidated helper (BOM lost).
snippets/csharp/System.Diagnostics/Process/Overview/processstartstatic.cs Rename sample type and change MainRun (BOM lost).
snippets/csharp/System.Diagnostics/Process/Overview/processstart.cs Rename sample type and change MainRun.
snippets/csharp/System.Diagnostics/Process/OnExited/Project.csproj Switch project to Exe for runnable sample.
snippets/csharp/System.Diagnostics/Process/OnExited/program.cs Modernize constructor usage and this. removal.
snippets/csharp/System.Diagnostics/Process/MainWindowTitle/Project.csproj Switch project to Exe for runnable sample.
snippets/csharp/System.Diagnostics/Process/MainWindowTitle/process_mainwindowtitle.cs Modernize ProcessStartInfo initialization.
snippets/csharp/System.Diagnostics/Process/MachineName/Project.csproj Switch project to Exe for runnable sample.
snippets/csharp/System.Diagnostics/Process/MachineName/process_getprocessesbyname2_2.cs Add braces and fix quoting in message.
snippets/csharp/System.Diagnostics/Process/Id/Project.csproj Switch project to Exe for runnable sample.
snippets/csharp/System.Diagnostics/Process/Id/program.cs Modernize parsing/disposal and simplify exception catch.
snippets/csharp/System.Diagnostics/Process/GetCurrentProcess/Project.csproj Switch project to Exe for runnable sample.
snippets/csharp/System.Diagnostics/Process/GetCurrentProcess/processstaticget.cs Modernize object creation.
snippets/csharp/System.Diagnostics/Process/EnableRaisingEvents/Project.csproj Switch project to Exe for runnable sample.
snippets/csharp/System.Diagnostics/Process/EnableRaisingEvents/processexitedevent.cs Modernize using/new patterns (now includes redundant block).
snippets/csharp/System.Diagnostics/Process/Close/Project.csproj Switch project to Exe for runnable sample.
snippets/csharp/System.Diagnostics/Process/Close/process_refresh.cs Modernize using and improve loop clarity.
snippets/csharp/System.Diagnostics/Process/BasePriority/source.cs Modernize using and spacing.
snippets/csharp/System.Diagnostics/Process/BasePriority/Project.csproj Switch project to Exe for runnable sample.
snippets/csharp/System.Diagnostics/PresentationTraceLevel/Overview/SimpleBinding.csproj Formatting cleanup.
snippets/csharp/System.Diagnostics/PresentationTraceLevel/Overview/Person.cs Formatting normalization.
snippets/csharp/System.Diagnostics/PerformanceCounterType/Overview/rawfraction.cs Modernize collections/initializers and aliases.
snippets/csharp/System.Diagnostics/PerformanceCounterType/Overview/rateofcountspersecond64.cs Modernize collections/initializers and aliases.
snippets/csharp/System.Diagnostics/PerformanceCounterType/Overview/rateofcountspersecond32.cs Modernize collections/initializers and aliases.
snippets/csharp/System.Diagnostics/PerformanceCounterType/Overview/Project.csproj Switch project to Exe for runnable sample.
snippets/csharp/System.Diagnostics/PerformanceCounterType/Overview/program.cs Rename entry type and add dispatcher Main.
snippets/csharp/System.Diagnostics/PerformanceCounterType/Overview/numberofitems64.cs Modernize collections/initializers and aliases.
snippets/csharp/System.Diagnostics/PerformanceCounterType/Overview/numberofitems32.cs Modernize formatting and alias usage.
snippets/csharp/System.Diagnostics/PerformanceCounterType/Overview/averagetimer32.cs Modernize formatting and alias usage; MainRun.
snippets/csharp/System.Diagnostics/PerformanceCounterCategory/Overview/Project.csproj Simplify TF/output and keep package reference.
snippets/csharp/System.Diagnostics/PerformanceCounterCategory/Overview/perfcountercatcreateexist.cs Modernize spacing and exception handling formatting.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread snippets/csharp/System.Diagnostics/Trace/Assert/source.cs Outdated
Comment thread snippets/csharp/System.Diagnostics/Process/Overview/processstartstatic.cs Outdated
Comment thread snippets/csharp/System.Diagnostics/Process/Overview/processstartstatic2.cs Outdated
Comment thread snippets/csharp/System.Diagnostics/Process/Overview/processstartstatic3.cs Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 159 out of 161 changed files in this pull request and generated 8 comments.

Suppressed comments (4)

Previously missed (4) — in code that hasn't changed since the last review.

snippets/csharp/System.Diagnostics/PerformanceCounterType/Overview/program.cs:139

  • Rename the misspelled local variable to denominator.
        float denomenator = (float)s1.BaseValue - (float)s0.BaseValue;

snippets/csharp/System.Diagnostics/PerformanceCounterType/Overview/rawfraction.cs:155

  • Rename the misspelled local variable to denominator.
        float denomenator = (float)rfSample.BaseValue;

snippets/csharp/System.Diagnostics/PerformanceCounterType/Overview/rateofcountspersecond32.cs:141

  • Rename the misspelled local variable to denominator.
        float denomenator = (float)(s1.TimeStamp - s0.TimeStamp) / (float)s1.SystemFrequency;

snippets/csharp/System.Diagnostics/PerformanceCounterType/Overview/rateofcountspersecond64.cs:142

  • Rename the misspelled local variable to denominator.
        float denomenator = (float)(s1.TimeStamp - s0.TimeStamp) / (float)s1.SystemFrequency;

Comment thread snippets/csharp/System.Diagnostics/ProcessStartInfo/Verb/Project.csproj Outdated
Comment thread snippets/csharp/System.Diagnostics/ProcessStartInfo/Verb/source.cs Outdated
Comment thread snippets/csharp/System.Diagnostics/Process/Overview/processstartstatic2.cs Outdated
Comment thread snippets/csharp/System.Diagnostics/Process/Overview/processstartstatic3.cs Outdated
Comment thread snippets/csharp/System.Diagnostics/Process/StandardOutput/stdoutput-sync.cs Outdated
Comment thread snippets/csharp/System.Diagnostics/Process/StandardOutput/stdoutput-async.cs Outdated
Comment thread snippets/csharp/System.Diagnostics/Process/StandardError/stderror-sync.cs Outdated
Comment thread snippets/csharp/System.Diagnostics/Process/StandardOutput/write500lines.cs Outdated
gewarren and others added 3 commits August 27, 2026 13:28
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@gewarren

Copy link
Copy Markdown
Collaborator Author

@copilot Please respond to remaining code review comments.

Co-authored-by: gewarren <24882762+gewarren@users.noreply.github.com>

Copilot AI commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

@copilot Please respond to remaining code review comments.

Addressed in the latest commit:

  • ProcessStartInfo/Verb/Project.csproj now uses Exe instead of WinExe, so console prompts stay visible.
  • Process/StandardError/stderror-sync.cs had a stale Main/Run mismatch that actually broke the build (Program.cs called Example.Run() but the method was named Main); renamed it to Run to fix the build.
  • For processstartstatic3.cs (ArgsEcho) and write500lines.cs (Write500Lines), moved them into their own standalone subprojects with real Main/top-level entry points, matching the documented "creates a separate application" narrative in ProcessStartInfo.xml/Process.xml. Updated the source= references in those XML files accordingly, and removed the now-unused SampleProcess/Write500Lines dispatcher scaffolding that was left over from an earlier iteration.

All affected projects build cleanly with 0 warnings/errors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants