I'm trying to (de)serialize a complex class that, among other things contains a member that has a type class that implements IEnumerable.
public class ClassToSerialize { public IEnumerableClass Foo; }
public class IEnumerableClass: IEnumerable<Bar> { ... }
The serialization works just fine. When deserializing I get a "Newtonsoft.Json.JsonSerializationException: 'Cannot create and populate list type" exception. The normal solution would be to decorate IEnumerableClass with [JsonObject] (as per this answer). The problem is I do not have access to the class code so I need a solution from within the (de)serializer itself. I have tried creating a custom contract resolver but so far have not had any success.