Skip to content

Updgrade from v6 -> v8. TimeZoneInfo.ConvertTimeBySystemTimeZoneId: No coercion operator is defined between types 'NodaTime.LocalDateTime' and 'System.Nullable`1[System.DateTime]' #3213

@ShawnOwczarzak

Description

@ShawnOwczarzak

Issue:

We are attempting to upgrade our projects from Dotnet 6 to Dotnet 8. When using TimeZoneInfo.ConvertTimeBySystemTimeZoneId in a DbContext that is setup to .UseNodaTime(), an SQL query can no longer be generated. No coercion operator is defined between types 'NodaTime.LocalDateTime' and 'System.Nullable'1[System.DateTime]'

Our project is a mixed DateTime/NodaTime as we incrementally move away from NodaTime. Thankfully the functionality that uses TimeZoneInfo.ConvertTimeBySystemTimeZoneId is not widespread. So our work around is to use NodaTime.Instant and it's related .InZone(...) call. But we would expect DateTime focused calls to still function, even when .UseNodaTime() is used.

Versions:

<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.6" />
<PackageReference Include="Npgsql" Version="8.0.3" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="8.0.4" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL.NodaTime" Version="8.0.4" />

Repo projects

Issue.Npgsql.NodaTime.TimeZoneInfo.Dotnet8.zip

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions