Fix AdHocJsonQuery test failures on hotfix/9.0.5#3818
Merged
roji merged 1 commit intohotfix/9.0.5from Apr 26, 2026
Merged
Conversation
EF Core 9.0.14 added AdHocJsonQueryTestBase tests (region #21006) that seed DateTime values with DateTimeKind.Unspecified. Npgsql's NpgsqlTimestampTzTypeMapping throws for non-default Unspecified DateTimes during JSON serialization. Override Seed21006 in AdHocJsonQueryNpgsqlTest to use UTC DateTimes for entity 1 and insert entities 2-6 via raw SQL (matching the pattern used by SQL Server's test class). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Fixes regressions and test failures introduced after updating the hotfix branch to EF Core 9.0.14 / Npgsql 9.0.5, including provider behavior changes around JSON DateTime seeding, enum/type mapping, migrations SQL generation, and various query translation baselines.
Changes:
- Override AdHoc JSON test seeding to avoid
DateTimeKind.Unspecifiedserialization failures by using UTC and raw SQL inserts. - Add/update provider behavior for data source configuration, value generation, enum/type parsing, array conversion, migrations SQL generation, and query translations; refresh corresponding unit/functional test baselines.
- Update SDK/package versions and CI workflow configuration for the hotfix branch.
Reviewed changes
Copilot reviewed 1 out of 1 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| test/EFCore.PG.Tests/Storage/NpgsqlTypeMappingSourceTest.cs | Adds coverage for store type name parsing behavior. |
| test/EFCore.PG.Tests/NpgsqlValueGeneratorSelectorTest.cs | Updates expected generator types for string value generation. |
| test/EFCore.PG.Tests/NpgsqlRelationalConnectionTest.cs | Adds test coverage for configuring a data source without a connection string. |
| test/EFCore.PG.Tests/NpgsqlDbContextOptionsExtensionsTest.cs | Adds regression test around service provider reuse with varying data source connection strings. |
| test/EFCore.PG.FunctionalTests/Query/PrimitiveCollectionsQueryNpgsqlTest.cs | Adds SQL baseline for ImmutableArray parameter Contains translation. |
| test/EFCore.PG.FunctionalTests/Query/EnumQueryTest.cs | Adds uppercase-named enum mapping and related query baseline. |
| test/EFCore.PG.FunctionalTests/Query/ArrayListQueryTest.cs | Updates SQL baseline for array_position nullability handling. |
| test/EFCore.PG.FunctionalTests/Query/ArrayArrayQueryTest.cs | Updates SQL baseline for array_position nullability handling. |
| test/EFCore.PG.FunctionalTests/Query/AdHocJsonQueryNpgsqlTest.cs | Overrides seeding to use UTC DateTimes and raw SQL inserts to match EF tests. |
| test/EFCore.PG.FunctionalTests/NpgsqlDatabaseCreatorTest.cs | Adjusts test subclass constructor signature for DatabaseCreator changes. |
| test/EFCore.PG.FunctionalTests/Migrations/MigrationsNpgsqlTest.cs | Adds/updates migration tests for collation preservation and enum label ordering behavior. |
| test/EFCore.PG.FunctionalTests/Migrations/MigrationsInfrastructureNpgsqlTest.cs | Updates overrides/conditions to match upstream behavior and PG version requirements. |
| test/EFCore.PG.FunctionalTests/BadDataJsonDeserializationNpgsqlTest.cs | Fixes test class naming for Npgsql provider. |
| src/EFCore.PG/ValueGeneration/NpgsqlSequentialStringValueGenerator.cs | Introduces sequential string value generator based on sequential GUIDs. |
| src/EFCore.PG/ValueGeneration/Internal/NpgsqlValueGeneratorSelector.cs | Selects sequential value generators for Guid and string under specific conditions. |
| src/EFCore.PG/Utilities/Util.cs | Extends cached boolean arrays used for nullability propagation metadata. |
| src/EFCore.PG/Storage/ValueConversion/NpgsqlArrayConverter.cs | Refactors array conversion expression building and null-handling. |
| src/EFCore.PG/Storage/Internal/NpgsqlTypeMappingSource.cs | Adds store type parsing helper and adjusts enum mapping resolution to support quoted names. |
| src/EFCore.PG/Storage/Internal/NpgsqlDatabaseCreator.cs | Refactors Exists/ExistsAsync and ensures connections close via finally during type reload. |
| src/EFCore.PG/Storage/Internal/NpgsqlDataSourceManager.cs | Changes when a data source is created and allows ConfigureDataSource without connection string. |
| src/EFCore.PG/Query/Internal/NpgsqlParameterBasedSqlProcessorFactory.cs | Makes factory Create method virtual for extensibility. |
| src/EFCore.PG/Query/ExpressionTranslators/Internal/NpgsqlByteArrayMethodTranslator.cs | Adds translation for Enumerable.Any() over bytea-mapped columns. |
| src/EFCore.PG/Query/ExpressionTranslators/Internal/NpgsqlArrayMethodTranslator.cs | Fixes nullability propagation metadata for array_position. |
| src/EFCore.PG/Migrations/NpgsqlMigrationsSqlGenerator.cs | Adjusts ALTER COLUMN collation generation and enum label add-ordering logic. |
| src/EFCore.PG/Migrations/Internal/NpgsqlMigrator.cs | Ensures connection closure via finally during ReloadTypes. |
| src/EFCore.PG/Metadata/Conventions/NpgsqlSharedTableConvention.cs | Sets uniqueness behavior flags for shared-table conventions. |
| src/EFCore.PG/Internal/EnumerableMethods.cs | Restores AnyWithoutPredicate method info lookup. |
| src/EFCore.PG/Infrastructure/Internal/NpgsqlOptionsExtension.cs | Copies DataSourceBuilderAction and changes service provider hash behavior for data source config. |
| global.json | Pins SDK version and adjusts rollForward behavior. |
| EFCore.PG.sln.DotSettings | Adds “timestamptz” to the user dictionary. |
| Directory.Packages.props | Updates EF Core / Npgsql and test/tooling package versions. |
| Directory.Build.props | Updates version prefix, warning suppressions, and copyright year. |
| .gitignore | Ignores *.lscache files. |
| .github/workflows/trigger-doc-build.yml | Adds minimal permissions block. |
| .github/workflows/codeql-analysis.yml | Removes CodeQL workflow. |
| .github/workflows/build.yml | Adjusts permissions, PG matrix versions, and NuGet publishing auth flow; modifies SDK setup usage. |
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.
EF Core 9.0.14 added
AdHocJsonQueryTestBasetests (region#21006) that seedDateTimevalues withDateTimeKind.Unspecified. Npgsql'sNpgsqlTimestampTzTypeMappingthrowsArgumentExceptionfor non-default UnspecifiedDateTimes during JSON serialization. These tests were never CI-tested on the hotfix branch because the dependency bump commit was pushed as part of the release process without triggering CI.This overrides
Seed21006inAdHocJsonQueryNpgsqlTestto:DateTimeKind.Utc(soSaveChangesAsync()succeeds)