Skip to content

Commit

Permalink
Fix JSON serialization of GrainReferences with null or empty `Grain…
Browse files Browse the repository at this point in the history
…InterfaceType` (#9178)

Fix JSON serialization of GrainReferences with null or empty GrainInterfaceType
  • Loading branch information
ReubenBond authored Oct 15, 2024
1 parent 1bd2906 commit db53d72
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Orleans.Core/Serialization/OrleansJsonSerializer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,8 @@ public override object ReadJson(JsonReader reader, Type objectType, object exist
JObject jo = JObject.Load(reader);
var id = jo["Id"];
GrainId grainId = GrainId.Create(id["Type"].ToObject<string>(), id["Key"].ToObject<string>());
var iface = GrainInterfaceType.Create(jo["Interface"].ToString());
var encodedInterface = jo["Interface"].ToString();
var iface = string.IsNullOrWhiteSpace(encodedInterface) ? default : GrainInterfaceType.Create(encodedInterface);
return this.referenceActivator.CreateReference(grainId, iface);
}
}
Expand Down

0 comments on commit db53d72

Please sign in to comment.