Skip to content

build: eliminate all compiler warnings (CS8618, CS1591, CS8625, CS2254, IDE0005)#4972

Merged
arturcic merged 8 commits into
mainfrom
feature/fix-warnings
Jun 11, 2026
Merged

build: eliminate all compiler warnings (CS8618, CS1591, CS8625, CS2254, IDE0005)#4972
arturcic merged 8 commits into
mainfrom
feature/fix-warnings

Conversation

@arturcic

@arturcic arturcic commented Jun 10, 2026

Copy link
Copy Markdown
Member

Summary

A series of commits that progressively enable compiler warnings and fix all violations, resulting in a clean build (0 warnings, 0 errors) across all target frameworks (net8.0, net9.0, net10.0). dotnet format --verify-no-changes also passes cleanly.

Commits

  • re-enable global warnings and fix specific violations — Removes suppressions for CS8604, CS8620, CS0618; fixes with pragmas and necessary casts
  • enable nullable warnings and resolve violations — Enables CS8618 in non-test projects; fixes violations using required, = null!, and field initializers across Arguments, ConfigurationBuilderBase, and all MSBuild task classes; updates PublicAPI.Shipped.txt
  • add XML documentation to GitVersion.Core public API — Adds /// <summary> to all 1,468 public types and members in GitVersion.Core, eliminating all CS1591 warnings from the project's <DocumentationFile> setting
  • enable CS8618 warnings and resolve nullable field violations — Removes the global CS8618 suppression for test projects; fixes MsBuildTaskFixtureResult, MsBuildExeFixtureResult (required), MockTaskItem (= null!)
  • enable CS8625 and CS2254 warnings while enforcing IDE0005 — Removes remaining global suppressions; adds IDE0005 to flag unnecessary using directives
  • fix CS8618 in test fixtures — Adds = null! to [SetUp]-initialized fields across 28 test files

Test plan

  • dotnet build src/GitVersion.slnx → 0 warnings, 0 errors (all TFMs)
  • dotnet build src/GitVersion.slnx --framework net10.0 --no-incremental → 0 warnings
  • dotnet format ./src/GitVersion.slnx --exclude "**/AddFormats/" --verify-no-changes passes

🤖 Generated with Claude Code

@arturcic arturcic added this to the 6.x milestone Jun 10, 2026
arturcic and others added 8 commits June 10, 2026 22:48
Remove global suppressions for CS8604, CS8620, and CS0618 from Directory.Build.props. Fix resulting warnings by using pragmas for deprecated members and removing unnecessary casts.
Uncomment nullable and analyzer warnings in Directory.Build.props. Fix violations by initializing fields, using the 'required' modifier, and applying null-forgiving operators where appropriate.
Adds /// <summary> comments to all 1,468 public types and members in
GitVersion.Core that were missing XML docs, eliminating all CS1591
warnings. Also removes the stale commented-out NoWarn entry from
Directory.Build.props.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add permissions for `dotnet clean`, `dotnet format`, and wildcard support for `dotnet restore` to improve Claude Code's build and maintenance capabilities.
Remove the global suppression for CS8618 in Directory.Build.props and fix resulting warnings by using the 'required' modifier or null-forgiving operators.
Remove global suppressions for literal null to non-nullable reference types (CS8625) and logging format strings (CS2254). Add IDE0005 to ensure unnecessary usings are flagged across all projects.
Adds = null! to all [SetUp]-initialized fields across 28 test files,
resolving CS8618 warnings now that nullable warnings are enabled for
test projects. dotnet format --verify-no-changes passes cleanly.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…arameter

Resolve nullability warnings by ensuring the generic type parameter T in VariableProvider is non-nullable.
@arturcic
arturcic force-pushed the feature/fix-warnings branch from 59d8759 to 96173e7 Compare June 10, 2026 20:48
@sonarqubecloud

Copy link
Copy Markdown

@arturcic
arturcic merged commit eb16598 into main Jun 11, 2026
236 checks passed
@arturcic
arturcic deleted the feature/fix-warnings branch June 11, 2026 04:18
@mergify

mergify Bot commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Thank you @arturcic for your contribution!

@arturcic arturcic modified the milestones: 6.x, 6.8.0 Jun 30, 2026
@arturcic

Copy link
Copy Markdown
Member Author

🎉 This issue has been resolved in version 6.8.0 🎉
The release is available on:

Your GitReleaseManager bot 📦🚀

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant