Skip to content

Fix IDE0370 build errors from .NET 10 SDK analyzer#91

Merged
matt-edmondson merged 1 commit into
mainfrom
claude/happy-brown-garksz
Jun 12, 2026
Merged

Fix IDE0370 build errors from .NET 10 SDK analyzer#91
matt-edmondson merged 1 commit into
mainfrom
claude/happy-brown-garksz

Conversation

@matt-edmondson

Copy link
Copy Markdown
Contributor

Summary

Fixes the CI failure in run 27384038671, where the build failed with 32 IDE0370: Suppression is unnecessary errors raised by the .NET SDK 10.0.301 analyzers (with code-analysis warnings treated as errors).

Note: the job shows a green check because the workflow's release step concluded successfully, but the KtsuBuild step logged Build FAILED ... 32 Error(s) / CI/CD pipeline failed: Build failed with exit code 1.

All 9 flagged locations were null-forgiving (!) operators:

  • Semantics.Quantities/Core/SemanticQuantity.cs (7 locations): Create<TResult>(...) returns a non-nullable TQuantity, so the trailing ! on the Multiply/Divide/Add/Subtract/Negate return statements was never needed. Removed.
  • Semantics.Strings/SemanticString.cs (2 locations in FromStringInternal): IDE0370 fired in the netstandard2.0/2.1 builds where the BCL reference assemblies are nullability-oblivious, but simply deleting the ! would break the annotated net5.0+ builds (Activator.CreateInstance returns object?, Type.GetProperty returns PropertyInfo?). Replaced the suppressions with Ensure.NotNull(...) (Polyfill), which is correct in both nullable contexts and fails fast with ArgumentNullException instead of a later NRE.

Verification

Built Semantics.Strings (all 8 TFMs) and Semantics.Quantities (all 5 TFMs) in Release with the .NET 10 SDK: no IDE0370 and no new nullable (CS86xx) diagnostics. (Local-only IDE0055 formatting noise from LF line endings on Linux checkouts is pre-existing and does not occur on the Windows CI runners.)

https://claude.ai/code/session_01LBGrmJHgP4RpMC9dQ2Pdox


Generated by Claude Code

The scheduled CI build failed with 32 IDE0370 (suppression is
unnecessary) errors raised by the .NET SDK 10.0.301 analyzers with
warnings treated as errors.

- SemanticQuantity.cs: remove null-forgiving operators on
  Create<TResult>(...) calls; Create returns a non-nullable TQuantity
  so the suppressions were never needed.
- SemanticString.cs: replace null-forgiving operators in
  FromStringInternal with Ensure.NotNull, which is valid in both the
  nullable-annotated (net5.0+) and oblivious (netstandard2.x) builds
  where IDE0370 flagged the suppressions.

https://claude.ai/code/session_01LBGrmJHgP4RpMC9dQ2Pdox
@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
36.5% Coverage on New Code (required ≥ 80%)
C Reliability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

@matt-edmondson matt-edmondson merged commit 3365dd0 into main Jun 12, 2026
4 of 5 checks passed
@matt-edmondson matt-edmondson deleted the claude/happy-brown-garksz branch June 12, 2026 06:57
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