Skip to content

Fix Release-build analyzer errors blocking develop -> main release#30

Merged
Chris-Wolfgang merged 1 commit into
developfrom
fix/release-build-analyzer-errors
Apr 27, 2026
Merged

Fix Release-build analyzer errors blocking develop -> main release#30
Chris-Wolfgang merged 1 commit into
developfrom
fix/release-build-analyzer-errors

Conversation

@Chris-Wolfgang

Copy link
Copy Markdown
Owner

Summary

Release builds now run with TreatWarningsAsErrors=true (set in Directory.Build.props for Release config). Local verification of develop after PR #28 surfaced analyzer findings that Debug builds didn't enforce. Fixing them now so the eventual develop -> main release PR clears the validate-release and pack-and-validate jobs in release.yaml.

src

  • InMemoryLoggerBuilderExtensions.AddInMemoryLogger — add <exception> XML doc for ArgumentNullException (RCS1140)
  • InMemoryLoggerProvider.CreateLogger — add <exception> XML doc for ArgumentNullException (RCS1140)
  • InMemoryLoggerProvider — mark sealed (CA1063, S3881). No overridable members and the existing no-op Dispose doesn't justify the full Dispose(bool) pattern.

tests

  • InMemoryLoggerTests.Log_when_called_adds_entry_to_LogEntries and the <T> equivalent:
    • Name the exception argument explicitly (MA0003)
    • Discard unused exception parameter in the formatter delegate (RCS1163, S3257)
    • Use IReadOnlyList<T> indexer instead of First() (CA1826)

Test plan

  • dotnet build "In-Memory Logger.slnx" -c Release — 0 errors / 0 warnings
  • dotnet test "In-Memory Logger.slnx" -c Release — 52/52 passing on net462, net47, net471, net472, net48, net481, net6.0, net7.0, net8.0, net9.0, net10.0
  • CI confirms

🤖 Generated with Claude Code

Release builds now run 'dotnet build -c Release' with TreatWarningsAsErrors,
which surfaced existing analyzer findings that Debug builds didn't enforce.

src:
- InMemoryLoggerBuilderExtensions.AddInMemoryLogger: add <exception> XML doc
  for ArgumentNullException (RCS1140)
- InMemoryLoggerProvider.CreateLogger: add <exception> XML doc for
  ArgumentNullException (RCS1140)
- InMemoryLoggerProvider: mark sealed (CA1063, S3881). The class has no
  overridable members and the existing no-op Dispose doesn't justify the
  full Dispose(bool) pattern.

tests:
- InMemoryLogger{,OfT}Tests.Log_when_called_adds_entry_to_LogEntries:
  - Name the 'exception' parameter explicitly (MA0003)
  - Discard unused 'exception' parameter in the formatter delegate
    (RCS1163, S3257)
  - Use indexer on IReadOnlyList instead of First() (CA1826)

Verified locally: Release build 0/0, 52 tests pass on all TFMs.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@Chris-Wolfgang Chris-Wolfgang merged commit 81c6de9 into develop Apr 27, 2026
@Chris-Wolfgang Chris-Wolfgang deleted the fix/release-build-analyzer-errors branch April 27, 2026 02:08
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.

1 participant