Skip to content

v5: Mark Scalar obsolete#1681

Draft
angularsen wants to merge 1 commit into
maintenance/v5from
agl-codex/obsolete-scalar-v5
Draft

v5: Mark Scalar obsolete#1681
angularsen wants to merge 1 commit into
maintenance/v5from
agl-codex/obsolete-scalar-v5

Conversation

@angularsen

Copy link
Copy Markdown
Owner

Motivation

Scalar is planned for removal in v6 because it is a unitless value wrapper rather than a physical quantity. It was originally added in #889 for #849 as a way to put plain counts/values into an IQuantity shape, but it has not grown meaningful semantic usage in the codebase.

This v5 PR keeps the API intact while warning callers ahead of the v6 breaking removal in #1680.

Changes

  • Add ObsoleteText to Common/UnitDefinitions/Scalar.json.
  • Regenerate the Scalar quantity, nanoFramework quantity, and number extensions so callers see [Obsolete] warnings.

Validation

  • dotnet run --project CodeGen -p:NuGetAudit=false
  • dotnet build UnitsNet.sln -p:NuGetAudit=false
  • dotnet test UnitsNet.Tests -f net48 -p:NuGetAudit=false
  • dotnet test UnitsNet.Tests -f net9.0 -p:NuGetAudit=false
  • dotnet test UnitsNet.NumberExtensions.Tests -p:NuGetAudit=false

Note: generate-code.bat/plain restore on this maintenance branch is currently blocked by a NuGet audit warning for NuGet.Protocol 6.12.1, so validation used NuGetAudit=false to avoid changing dependencies in this deprecation PR.

Refs #849, #1200, #1679, #1680.

@angularsen angularsen changed the title Mark Scalar obsolete v5: Mark Scalar obsolete Jul 17, 2026
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