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:
But coming out of the cache here is what it looks like:
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?
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:
But coming out of the cache here is what it looks like:
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?