Skip to content

Value objects over Decimal32, Decimal64, Decimal128 and BFloat16 (net11.0) #212

Open

Description

@CaffeinatedCoder

What you're trying to do

Wrap .NET 11's new decimal types, and BFloat16, in a value object: readonly partial record struct Price : IValue<Decimal128>;. .NET 11 adds Decimal32, Decimal64 and Decimal128, with generic math and built-in System.Text.Json converters (JsonMetadataServices.Decimal128Converter and siblings; What's new in .NET 11 libraries).

What you'd like

A value object over each of them gets the generated surface its wrapped type supports, on a net11.0 consumer: JSON byte for byte as the wrapped type's (JsonParityTests, through GeneratedJsonPlan<T>), parsing, formatting, comparison and the type converter.

  • The generators key on the wrapped type's interfaces, so no new generated member is expected (decision 120, rule 3). Rows for the four types join the wrapped-type axes, and the tests run on net11.0.
  • The changelog and docs/value-objects.md mention them, if they work. If a member is missing or wrong, that's a bug filed on its own.
  • Also to measure: .NET 11 now rounds decimal and BigInteger-to-floating conversions correctly, with no compatibility switch. Check whether DecimalJsonConverters.cs or any generated member converts through double and would print differently on net11.0.

BFloat16 too. .NET 11 adds System.Numerics.BFloat16 with a built-in converter (JsonMetadataServices.BFloat16Converter) that honours JsonNumberHandling (AllowReadingFromString, WriteAsString, AllowNamedFloatingPointLiterals), works as a dictionary key and exports a JSON Schema (dotnet/runtime#131523). A value object over it gets the same rows as the three decimals: number handling, dictionary keys, and an OpenAPI schema that is the wrapped type's.

EF Core: no provider mapping is expected for the new types. Record what EF 11 does with one, and leave it out of scope unless it's silent.

Does it change something that compiles or works today?

No, it only adds coverage. The rounding check could find a difference between targets, which would be a bug.

Activity

  1. added this to the 2.4.0 milestone on Oct 30, 2026
  2. added
    enhancement
    package/generators
    area/value-objects
    area/json
    area/parsing
    on Oct 30, 2026
  3. added
    package/aspnetcore
    on Oct 31, 2026
  4. changed the title [-]Value objects over Decimal32, Decimal64 and Decimal128 (net11.0)[/-] [+]Value objects over Decimal32, Decimal64, Decimal128 and BFloat16 (net11.0)[/+] on Oct 31, 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/jsonarea/parsingarea/value-objectsenhancementpackage/aspnetcorepackage/generators

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions