Skip to content

The refusal of a format version says the wrong thing for a version that is not a number, and for an older one #50

Closed

Description

@CaffeinatedCoder

Found by the analysis of #46. Both are refused; only the message is wrong.

Problem

DeclarationCodec.Read (Declarations/Internal/DeclarationCodec.cs) checks v with TryGetInt32 before looking at the element's kind.

  1. "v":"2" throws System.Text.Json's own InvalidOperationException, "The requested operation requires an element of type 'Number', but the target element has type 'String'", with no annotation key in it. Reproduced on .NET 9, 10 and 11.
  2. A v below 2 gets UnknownFormatVersion, which says the snapshot "was written by a newer SchemaKit … Update the package". For an older format that is the wrong advice.

Done when

A v that is not a whole number is refused with UnknownFormatVersion and the key, and the message for a lower version does not say "newer". A test for each.

Activity

  1. added this to the 11.0.0 milestone on Nov 11, 2026
  2. added
    bug
    package/core
    severity/low
    area/migrations
    on Nov 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/migrationsbugpackage/coreseverity/low

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions