When I compile Type model dictionary stops working.
[Test]
public void TestCompileSerialization()
{
var data = new Dictionary<int, int>();
data[1] = 1;
var typeModel = TypeModel.Create();
var compiledTypeModel = typeModel.Compile();
using (var memory = new MemoryStream())
{
compiledTypeModel.Serialize(memory, data);
}
}
This test throws
Type is not expected, and no contract can be inferred: System.Collections.Generic.KeyValuePair`2[[System.Int32, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.Int32, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]]
Do I need to add every dictionary that I might want to serialize to TypeModel or there are some other ways?
BTW I don't get why do I have to make everything public when I want to precompile serializers?