Hi I've been trying to use a silverlight client to call an asp.net wcf service that would return a Dictionary. That worked fine when the values in the dictionary were simples types like int, string or Guid.
However, I now have a scenario where I need one of the values to be an array of dictionary ! It all compiles fine and the signature of the service has not changed but the service call nows fails.
Any ideas how to fix it ? I've trying to annotate my service class and methods with the KnownType and ServiceKnownType attributes but that didn't work.
Here is a piece of code:
[ServiceContract(Namespace = "")]
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
public class Service1
{
[OperationContract]
[ServiceKnownType(typeof(Dictionary<string, object>))]
public Dictionary<string, object> GetObject()
{
return new Dictionary<string, object>()
{
{ "pty1", 1 },
{ "pty2", Guid.NewGuid() },
{ "pty3", "blah" },
{ "pty4", new Dictionary<string, object>[]
{
new Dictionary<string, object>()
{
{ "pty1", 4 },
{ "pty2", Guid.NewGuid() },
{ "pty3", "blah" },
}
,
new Dictionary<string, object>()
{
{ "pty1", 4 },
{ "pty2", Guid.NewGuid() },
{ "pty3", "blahblah" },
}
}
}
};
}
}