Repository navigation
fix: Float64Range/Float32Range.FormatValue read an empty format as no format (#655) - #657
Merged
Merged
Conversation
…s no format (#655) Both tested format is null, where their set siblings and every other type read an empty format as none, so FormatValue(1.5, "", de-DE) wrote 1,5 and FormatValue(1e300, "", invariant) wrote 1E+300. The literal never reached it. EveryFormatValue_ReadsAnEmptyFormat_AsItsDefault now sweeps the five providers and the set probes as well as the range bounds; without the fix it fails for both types. Found-By: SpanFormatContractTests (#41), comparing TryFormatValue with FormatValue Defect-Class: clone divergence between sibling FormatValue overrides Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Closes #655
Problem
Float64Range.FormatValueandFloat32Range.FormatValuetestedformat is null, where their set siblings (Float64Set,Float32Set) and every other type read an empty format as none. SoFloat64Range.FormatValue(1.5, "", de-DE)wrote1,5, andFormatValue(1e300, "", invariant)wrote1E+300where float8out writes1e+300. Nothing threw. The literal (ToString, interpolation, JSON, EF text) was never affected, because it turns""into null before it callsFormatValue. Only a directFormatValuecall was.SpanFormatContractTests(#41, PR #654) found it by comparingTryFormatValuewithFormatValue. The existing oracle missed it because it checked only the invariant provider and the range bounds, values on which .NET's text and float8out agree.Change
Float64Range.cs,Float32Range.cs:string.IsNullOrEmpty(format), as the sets have it.LiteralProviderContractTests.EveryFormatValue_ReadsAnEmptyFormat_AsItsDefaultnow sweeps the five providers as well as the invariant one, and the set probes (2^-25, 1e300, 0.1f, 1e6f) as well as the range bounds.changes/655.mdunder Breaking:ChangelogConventionTestsrefuses aChanged answerssection in a major, andpr-hygiene.shputs a silent fix into a major under Breaking. Migration section "CheckFormatValueon the float ranges with an empty format", with a bullet in the v10.x list.Tests
EveryFormatValue_ReadsAnEmptyFormat_AsItsDefaultfails for both float ranges under de-DE, sv-SE, fa-IR and ar-SA (null -> '-1.5', "" -> '-1,5'). With the fix it passes.float-range-reads-an-empty-format-as-explicit(oracleLiteralProviderContractTests), generated from the committed tree.OracleSeedTestsis green.10.x: the same code is on
release/10.x(Float64Range.cs:329,Float32Range.cs:330). Under the silent rule a port ships as a 10.x minor with aChanged answersrow. Whether to port is steering's call; this PR doesn't include one.🤖 Generated with Claude Code