Skip to content

Suppress noisy analyzer rules in benchmarks and examples csproj#97

Merged
Chris-Wolfgang merged 1 commit into
chore/fix-analyzer-violations-result-tryfrom
chore/suppress-analyzer-noise-benchmarks-examples
May 2, 2026
Merged

Suppress noisy analyzer rules in benchmarks and examples csproj#97
Chris-Wolfgang merged 1 commit into
chore/fix-analyzer-violations-result-tryfrom
chore/suppress-analyzer-noise-benchmarks-examples

Conversation

@Chris-Wolfgang
Copy link
Copy Markdown
Owner

Why

CI's Stage 2 (Windows) is reporting analyzer errors in the benchmarks and examples projects:

  • benchmarks/Wolfgang.TryPattern.Benchmarks/TryBenchmarks.cs — VSTHRD200, MA0004
  • examples/CSharp.DotNet8.Example/Program.cs — MA0004, S6966

These rules are already relaxed in .editorconfig's [benchmarks/**/*.cs] and [examples/**/*.cs] sections, but the Windows CI runner doesn't fully honor those section relaxations (same root cause we hit on the test project). Moving the suppressions to the project level via <NoWarn> makes MSBuild apply them reliably.

What

  • Benchmarks csproj: NoWarn for MA0004, VSTHRD200, S6966
  • Examples csproj: NoWarn for MA0004, S6966

Both blocks include a comment explaining why the suppressions live at the project level rather than relying on .editorconfig.

Verification

  • dotnet build --configuration Release → 0 warnings, 0 errors locally
  • Should clear the remaining 28 analyzer errors on Stage 2

Context

Split off from #94 per request — keeps that PR focused on the cancellation-token observance + test-project fixes and lets this benchmarks/examples cleanup land independently.

🤖 Generated with Claude Code

CI surfaced remaining analyzer errors in benchmarks and examples that
my earlier fix only addressed in the test csproj. Same root cause: the
Windows CI runner doesn't fully honor .editorconfig section relaxations
for [benchmarks/**/*.cs] and [examples/**/*.cs], so we move the
suppressions to the project level where MSBuild applies them reliably.

Benchmarks NoWarn: MA0004, VSTHRD200, S6966
Examples NoWarn:   MA0004, S6966

Verified: 0 warnings/errors local clean build.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings May 2, 2026 17:08
@Chris-Wolfgang Chris-Wolfgang changed the base branch from main to chore/fix-analyzer-violations-result-try May 2, 2026 17:09
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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 moves a small set of analyzer suppressions from .editorconfig into the affected benchmark and example project files so MSBuild applies them reliably on Windows CI. It fits the codebase’s existing pattern of relaxing analyzer rules for non-library projects without changing runtime behavior.

Changes:

  • Add project-level NoWarn entries to the .NET 8 example project for MA0004 and S6966.
  • Add project-level NoWarn entries to the benchmark project for MA0004, VSTHRD200, and S6966.
  • Document in each .csproj why these suppressions are duplicated at the project level instead of relying only on .editorconfig.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
examples/CSharp.DotNet8.Example/CSharp.DotNet8.Example.csproj Adds project-level analyzer suppressions for the example app to stabilize CI behavior.
benchmarks/Wolfgang.TryPattern.Benchmarks/Wolfgang.TryPattern.Benchmarks.csproj Adds project-level analyzer suppressions for benchmark code where those rules are intentionally relaxed.

@Chris-Wolfgang Chris-Wolfgang merged commit 3b7a5e1 into chore/fix-analyzer-violations-result-try May 2, 2026
9 of 11 checks passed
@Chris-Wolfgang Chris-Wolfgang deleted the chore/suppress-analyzer-noise-benchmarks-examples branch May 2, 2026 17:09
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.

2 participants