Repository navigation
Clear the compiler warnings from the test projects - #4927
Merged
Merged
Conversation
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]>
akira28
approved these changes
Nov 18, 2026
Contributor
Docs preview (local build)Handbook preview: https://docs-v3-preview.elastic.dev/elastic/docs-builder/pull/4927/ |
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.
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.propssetsTreatWarningsAsErrorsto false, so new warnings in tests never fail a build. They hide real ones in the log.What
Culture-safe formatting (CA1305)
Interpolated
StringBuilder.Appendcalls andToString()calls on numbers and dates now passCultureInfo.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(...).RootElementbecameJsonElement.Parse, which does not leak the document.Regex.Matches(...).CountbecameRegex.Count. A sharedJsonSerializerOptionsreplaces a per-call instance.Nullability and obsolete API
Fixed CS8619, CS8601 and CS8602 in test helpers. The Testcontainers
ContainerBuildertakes the image in its constructor. OneRegexbecame a[GeneratedRegex]with a match timeout.Naming
The
ConfigureDocumentationSetparameter is nowdocumentationSet(CA1716, CA1725).StringBuilder.Append(char)replaces a one-character string (CA1834).Verify
The summary reports
0 Warning(s). The unit test projects touched here all pass.