Skip to content

Clear the compiler warnings from the test projects - #4927

Merged
Mpdreamz merged 1 commit into
mainfrom
feature/i-notice-have-lot
Nov 18, 2026
Merged

Mpdreamz merged 1 commit into
mainfrom
feature/i-notice-have-lot

Conversation

@Mpdreamz

Copy link
Copy Markdown
Member

The solution builds with zero compiler warnings again. Test projects do not treat warnings as errors, so about 50 had piled up there.

Affects: Automation

Prompt summary: CI output for a test build showed a lot of compiler warnings in the test projects. The ask is to fix them so the build output is clean again.

Why

tests/Directory.Build.props sets TreatWarningsAsErrors to false, so new warnings in tests never fail a build. They hide real ones in the log.

What

Culture-safe formatting (CA1305)

Interpolated StringBuilder.Append calls and ToString() calls on numbers and dates now pass CultureInfo.InvariantCulture. Snapshot text no longer depends on the machine locale.

Constant arrays and JSON (CA1861, CA2026, CA1869, CA1875)

Constant arrays passed to extension methods became List<string>. JsonDocument.Parse(...).RootElement became JsonElement.Parse, which does not leak the document. Regex.Matches(...).Count became Regex.Count. A shared JsonSerializerOptions replaces a per-call instance.

Nullability and obsolete API

Fixed CS8619, CS8601 and CS8602 in test helpers. The Testcontainers ContainerBuilder takes the image in its constructor. One Regex became a [GeneratedRegex] with a match timeout.

Naming

The ConfigureDocumentationSet parameter is now documentationSet (CA1716, CA1725). StringBuilder.Append(char) replaces a one-character string (CA1834).

Verify

dotnet build docs-builder.slnx --no-incremental -v:m

The summary reports 0 Warning(s). The unit test projects touched here all pass.

Test projects do not treat warnings as errors, so about 50 had piled up: culture-sensitive formatting (CA1305), constant array arguments (CA1861), JsonDocument leaks (CA2026), nullability, and an obsolete ContainerBuilder constructor. The solution now builds with no warnings. Test behaviour is unchanged.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@Mpdreamz
Mpdreamz requested a review from a team as a code owner November 18, 2026 08:48
@Mpdreamz
Mpdreamz requested a review from theletterf November 18, 2026 08:48
@Mpdreamz Mpdreamz added the chore label Nov 18, 2026
@github-actions

Copy link
Copy Markdown
Contributor

@Mpdreamz
Mpdreamz merged commit ee4ef92 into main Nov 18, 2026
50 checks passed
@Mpdreamz
Mpdreamz deleted the feature/i-notice-have-lot branch November 18, 2026 09:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants