Updgrade from v6 -> v8. TimeZoneInfo.ConvertTimeBySystemTimeZoneId: No coercion operator is defined between types 'NodaTime.LocalDateTime' and 'System.Nullable`1[System.DateTime]'
ShawnOwczarzak opened this issue · comments
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
Thanks for the report and repro - I can see the bug and have submitted #3214, I'll backport to 8.0.x.