Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DateTime deserialized as null or default when using version >= 5 #464

Open
cmaart opened this issue Mar 14, 2023 · 3 comments
Open

DateTime deserialized as null or default when using version >= 5 #464

cmaart opened this issue Mar 14, 2023 · 3 comments
Assignees
Labels

Comments

@cmaart
Copy link

cmaart commented Mar 14, 2023

Describe the bug
Neo4j Driver seems to return DateTime as lazy-ZonedDateTime which is not deserialized as DateTime.

Seems to happen only when using return as anonymous object not when returning types directly.
Works:
Return.As<Model>("n")
DateTime properties are null
Return(() => new { MyModel = Return.As<Model>("n")})

Usage:
image

Deserialization in Neo4jClient shows Json contains lazy-ZonedDateTime
image

Downgrading to the latest 4.x version fixes the issue.

Versions:

  • Neo4jClient >= 5
  • Bolt
  • .NET 6
  • 5.2.0 Enterprise
@thelonelyvulpes
Copy link
Contributor

Hi @cmaart This is because of a change that was implemented in the dotnet driver. At the very latest, this will be fixed in 5.11.

@awatertrevi
Copy link

Issue still persists in 5.11.

@thelonelyvulpes
Copy link
Contributor

thelonelyvulpes commented Aug 24, 2023

@awatertrevi The driver was changed removing lazy parsing of ZonedDateTimes, but instead it can return something such as: "{ UtcSeconds: 1000, Nanoseconds: 0, Zone: "Antartica/Troll" }" this is because in order to convert the ZonedDateTime to the local date & time values the driver needs to be able to look up the offset from UTC, but if the zone is unknown to the OS it will fail.
The reason the driver does not throw is because zones that might not be legal on one machine may be legal on the neo4j server.

If you have further details or recreation scenarios that don't match this case, please let me know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants