There is a Service Fabric Rest (http) Service that exposes a POST endpoint which takes a contract called Action that has a Dictionary. The service accepts the Action and calls an Service Fabric RPC service to perform the create action operation.
public class Action{
public Dictionary<string, object> actions {get; set;}
}
When any type other than primitives (array, dictionary) are passed for the object type, the Rest endpoint deserializes the json properly, but fails at the place when trying to call the RPC Service with the following error message
Newtonsoft.Json.Linq.JToken' is a recursive collection data contract which is not supported. Consider modifying the definition of collection 'Newtonsoft.Json.Linq.JToken' to remove references to itself.
We have also tried using dynamic and ExpandoObject instead of object. That also doesn't seem to help.
Has any one faced this issue with passing object or dynamic types to RPC Services ?
Service remoting works with the DataContractSerializer. All types you use in the Service contract must be serializable by that.
The type JToken
is not, because it has properties of the same type.