Skip to content

Syncs to the released .NET 11 preview 7 build (11.0.0-preview.7.26381.103) - #3897

Open
buvinghausen wants to merge 4 commits into
npgsql:mainfrom
buvinghausen:bump_preview7
Open

Syncs to the released .NET 11 preview 7 build (11.0.0-preview.7.26381.103)#3897
buvinghausen wants to merge 4 commits into
npgsql:mainfrom
buvinghausen:bump_preview7

Conversation

@buvinghausen

@buvinghausen buvinghausen commented Aug 12, 2026

Copy link
Copy Markdown

Summary

  • Bump EF Core / Microsoft.Extensions packages to 11.0.0-preview.7.26381.103

  • Bump global.json SDK to 11.0.100-preview.7.26381.103 — required, not just
    convention: preview 7 moved Microsoft.Extensions.Primitives into the shared
    framework, so the new packages on the preview 6 runtime throw
    MissingMethodException (ChangeToken.OnChange) when the functional test
    configuration loads.

  • Implement Seed30915, newly abstract on AdHocMiscellaneousQueryRelationalTestBase
    (Nullable object must have a value thrown for a query with DefaultIfEmpty() dotnet/efcore#30915 test coverage); seeding copied from the SQL Server provider.

  • Override Correlated_SelectMany_DefaultIfEmpty_whole_object: the base test
    asserts the "no APPLY support" translation failure (SQLite behavior), but
    PostgreSQL supports LATERAL, so the query translates and runs. The override
    mirrors EF Core's SQL Server one and asserts the generated
    LEFT JOIN LATERAL … ON TRUE SQL.

    Verified locally against PostgreSQL (testcontainer): AdHocMiscellaneousQueryNpgsqlTest
    passes 120/121 (1 known-flaky skip)

Context

This version is expected to include dotnet/efcore#38586, which should have shipped in this preview. Opening this PR to validate that fix against Npgsql.EntityFrameworkCore.PostgreSQL since you explicitly lock preview versions the sooner I can get this released the better.

I've got SQL Server style temporal table support working but in order to fully and properly support crypto erasure in ASP.NET identity I need to break the user lockout properties and the password into a split table which itself is not-temporal so I'm blocked on testing at the moment.

The released preview 7 build (11.0.0-preview.7.26381.103) adds GroupBy + DefaultIfEmpty projection tests for dotnet/efcore#30915, with a new abstract Seed30915 member on AdHocMiscellaneousQueryRelationalTestBase. Implement it following the SQL Server provider's seeding
The preview 7 runtime is required at test time: Microsoft.Extensions.Primitives
moved into the shared framework, so running preview 7 packages on the preview 6
runtime fails with MissingMethodException (ChangeToken.OnChange) as soon as the
test configuration loads.

Also override Correlated_SelectMany_DefaultIfEmpty_whole_object: the base
asserts a translation failure for providers without APPLY support, but
PostgreSQL supports LATERAL, so the query translates and materializes
correctly. Mirrors the SQL Server override, with the Npgsql SQL baseline.
@buvinghausen buvinghausen changed the title Bump preview 7 to released 11.0.0-preview.7.26324.112 Syncs to the released .NET 11 preview 7 build (11.0.0-preview.7.26381.103) Aug 12, 2026
- Add NpgsqlParseTranslator: numeric Parse(string) -> CAST, mirroring SQL Server
- Override NpgsqlArrayTypeMapping.GetDefaultProviderValue: native arrays get an
  array default, not the JSON "[]" string the base now assumes (dotnet/efcore#38796)
- Add ~55 missing test overrides with PostgreSQL baselines; refresh 6 drifted ones
- Override Join_local_*_closure tests (PG char-cast semantics; byte[] joins translate)
- Reimplement owned-entity inconsistent-data test with quoted identifiers
- Seed EntitiesWithPrimitiveCollection in the precompiled-query fixture

Remaining failures are all dotnet/efcore#38796 (shaper assumes primitive
collections are stored as JSON strings), pending an upstream fix.
@buvinghausen

Copy link
Copy Markdown
Author

@roji — this bump turned into a bit of a state-of-the-union, so here's where things stand.

TL;DR: after the fixes in this PR, every remaining CI failure (~410 across PrimitiveCollectionsQuery*, JsonUpdate*, JsonQuery*, etc.) is a single upstream regression in the released preview 7 build, filed as dotnet/efcore#38796. There's nothing further to fix provider-side; once that's resolved in a new EF build this PR should go green as-is.

The upstream blocker (dotnet/efcore#38796): since dotnet/efcore#38498 (6a2d7a8a), ShaperProcessingExpressionVisitor.CreateGetValueExpression takes a "read JSON string via JsonValueReaderWriter" path for any primitive-collection mapping that has a converter with ConvertsNulls: false and a JsonValueReaderWriter. Our native array mappings match those conditions whenever there's an element converter (enum arrays etc. via NpgsqlArrayConverter, provider type int[]), so the shaper emits Convert(int[], string) and query compilation throws No coercion operator is defined between types 'System.Int32[]' and 'System.String'. Since it fires while building the entity shaper, one such property poisons every query over that entity — hence entire test classes going red.

What this PR now contains beyond the version bump:

  • global.json bumped to the preview 7 SDK — required, not just convention: Microsoft.Extensions.Primitives moved into the shared framework, so preview 7 packages on the preview 6 runtime throw MissingMethodException (ChangeToken.OnChange) as soon as the test config loads.
  • Seed30915 implemented, plus an override of Correlated_SelectMany_DefaultIfEmpty_whole_object — PostgreSQL has LATERAL, so the query translates instead of throwing like the SQLite-shaped base assertion (mirrors the SQL Server override).
  • New NpgsqlParseTranslator — numeric Parse(string) → CAST, mirroring the new SqlServerParseTranslator (new *_Parse spec tests).
  • NpgsqlArrayTypeMapping.GetDefaultProviderValue() override — the base now returns the JSON string "[]" for any mapping with an ElementTypeMapping + JsonValueReaderWriter (same loosened assumption as #38796), which sent a string into NpgsqlArrayConverter and broke Add_required_primitive_collection_to_existing_table. The override restores native-array semantics.
  • Test sync: ~55 missing overrides added with PG baselines (all Check_all_tests_overridden meta-tests pass), 6 drifted baselines refreshed, Join_local_string/bytes_closure overridden (char-cast semantics / byte[] joins do translate here), the owned-entity inconsistent-data test reimplemented with quoted identifiers (base seeds with unquoted raw SQL), and the precompiled-query fixture now seeds EntitiesWithPrimitiveCollection (the JSON-null-token scenario becomes a SQL NULL since we map to native arrays).

Deferred pending #38796: the 5 overrides in JsonQueryNpgsqlTest / PrimitiveCollectionsQueryNpgsqlTest are plain base-call stubs — their baselines can't be captured while the shaper throws. Happy to do a follow-up pass to fill those in once a fixed build is available.

@buvinghausen

Copy link
Copy Markdown
Author

Quick update: Given the upstream dumpster fire this repository inherited I fully do not expect you to publish a preview7 version to NuGet so no worries there I went ahead and published my fork's build to my private GitHub NuGet server so I can carry forwards fortunately I don't have any existing native scalars to array columns anywhere in my codebase so I won't hit it until this gets resolved. I'll leave this here for reference and perhaps we just carry it forwards to when RC1 drops next month just let me know.

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