Skip to content

Deserialization Issue with FusionCache using System.Text.Json #335

Description

@ianmccaul

When using FusionCache with the System.Text.Json serializers it seems the deserialization of the 'EFCachedData' object doesnt set the actual types of the row values. They will come across as JsonElement instead of base system types. Which then breaks downstream execution as it sees the JsonElement and doesnt know how to handle it a deserialization breaks. I have copied the code in the FusionCache provider to debug.

It goes into the cache correctly for example:

Image

But coming out of the cache here is what it looks like:

Image

So basically, the System.Text.Json will behave differently deserializing to object types then Newtonsoft will likely because of the TypeNameHandling functionality that is different in the System implementation. So question being can this be done with the base System.Text.Json classes, or does some custom type resolvers need to be created so its handled at the serializer level. Or can the interceptor take this into account?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions