Skip to content

[8.0] Translate ToString() on string expressions - #4052

Merged
roji merged 1 commit into
hotfix/8.0.12from
roji-string-tostring-backport-8-0
Oct 20, 2026
Merged

roji merged 1 commit into
hotfix/8.0.12from
roji-string-tostring-backport-8-0

Conversation

@roji

@roji roji commented Oct 20, 2026

Copy link
Copy Markdown
Member

Backports #4047 (5374dda) to hotfix/8.0.12.

Return string-mapped expressions unchanged from NpgsqlObjectToStringTranslator, matching SQL Server and SQLite without introducing casts or changing null propagation.

Preserves the original regression coverage for a string predicate, null propagation, and object-typed string grouping keys used in OrderBy and Where. Since EF Core 8 predates the StringTranslations suite, these tests use the existing Northwind functions suite and run synchronously and asynchronously. Also adds the inherited ToString_string_property_projection SQL assertions for GearsOfWar, TPC, and TPT.

Validation: all 54 ToString functional tests passed with .NET SDK 8.0.425 and VSTest against a dedicated PostgreSQL 16 container. All eight new regression cases failed with translation errors before the fix. No shared database or provisioning code changes.

dotnet test test/EFCore.PG.FunctionalTests/EFCore.PG.FunctionalTests.csproj --no-restore --filter 'FullyQualifiedName~ToString'

Fixes #4046.

Related to dotnet/efcore#20839 and its upstream fix dotnet/efcore#29349.

Backport #4047 (5374dda), adapting focused regression tests to the EF Core 8 Northwind model.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 8abbdb3d-122e-4300-b2dc-9c8482db2ec2
@roji
roji merged commit 90fab79 into hotfix/8.0.12 Oct 20, 2026
9 checks passed
@roji
roji deleted the roji-string-tostring-backport-8-0 branch October 20, 2026 12:52
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.

ToString() on a string expression fails to translate (“Translation of method ‘object.ToString’ failed”)

1 participant