Closed Aashish93-stack-zz closed 2 years ago
Thanks for reporting, @Aashish93-stack.
The primary issue here is that BinaryFormatter is disabled by default on .NET 5.0 and above.
Orleans 3.5.0 attempts to detect this and mitigate it by enabling the in-built ILBasedFormatter
in that case, however it is not working for you. It may be that the payload in your case was serialized by BinaryFormatter but is being deserialized by ILBasedSerializer.
One workaround is to reenable BinaryFormatter temporarily. That workaround is presented here: https://github.com/dotnet/orleans/issues/6805#issuecomment-717778302
There are a couple of issues here:
ILBasedSerializer
is enabled as a "keyed serializer" even when BinaryFormatterSerializer
is enabled as the fallback, and it will be used preferentially. I will see what kinds of fixes we can have for this case. It may be that we offer some kind of opt-in so that this serializer is only used if either it's been enabled or if it's explicitly referenced in the data.ILBasedSerializer
is deserializing an array referenced in your repro which is self-referential (one of the array members is the array itself). The type comes from DefaultContractResolver
, which arguably should not be serialized anyway. This is a bug which we should be able to safely fix without hurting any other cases.Thanks for the update @ReubenBond
Updating the example HelloWorld app to orleans 3.5.1 did not resolve the serialization error. Is there another work around needed or a working example? @ReubenBond @Aashish93-stack
We are in the process of upgrading our projects to orleans 3.5.0 and donet 5.0 and we observed that all of our JsonPatchDocument requests started to fail with the following
Unhandled exception. System.Runtime.Serialization.SerializationException: Reference with no referred object at Orleans.Internal.OrleansTaskExtentions.<ToTypedTask>g__ConvertAsync|4_0[T](Task1 asyncTask)
While trying to reproduce the same Issue on a the HelloWorld Sample project. On reproducing the issue, we noticed some interesting logs related to deserialization on the SiloHost and we believe we are seeing the same in our internal projects.
Versions used in the project
I have uploaded the zip file for the reproducer. Instructions for running are in the readme file HelloWorld.zip