In our program, we have a Dictionary
public Dictionary<string, object> GlobalState { get; set; }
in which we Add GlobalState.Add("__REFS__", new Dictionary<string, ActionInstanceReference>());
Where ActionInstanceReference
is a custom type with a few simple properties (all strings).
public class ActionInstanceReference
{
public string Type { get; set; }
public string Id { get; set; }
public string Url { get; set; }
public string PrettyPrint { get; set; }
}
Looking at what the serialized output is:
"__REFS__": {
"aaa": {
"__type": "MasterProcessServer.ServiceModel.Interfaces.ActionInstanceReference, MasterProcessServer.ServiceModel",
"type": "Message",
"prettyPrint": "Message to MDK 2892"
},
"bbb": {
"type": "Message",
"prettyPrint": "Message to MDK 612"
},
"ccc": {
"type": "Message",
"prettyPrint": "Message to MDK 0"
},
"ddd": {
"type": "Form",
"id": "7400",
"url": "xxxxx",
"prettyPrint": "Book exit conversation"
}
}
Here we can see that the last one, ddd
includes all the properties. Some others don’t have all, because they are NULL, which is OK. But why does aaa
include __type
and not the others?
Our JSConfig is:
JsConfig.Init(new ServiceStack.Text.Config
{
DateHandler = DateHandler.ISO8601,
AlwaysUseUtc = false,
TextCase = TextCase.CamelCase,
ExcludeDefaultValues = false,
IncludeNullValues = false
});
Now we’re suddenly getting error ActionInstanceReference is not an allowed Runtime Type. Whitelist Type with [Serializable] ....
, which we can do, but why does it suddenly happen now, and only sporadically?