This may be simply a limitation in "v1". I've added this as a test on "v2", and it passed (I had to invent UrlStatus
and TrafficEntry
to get it to compile):
public enum UrlStatus { A,B }
public enum TrafficEntry { A }
[ProtoContract]
public class SerializableException { }
[Test]
public void TestBasicRoundTrip()
{
var item = new ProtoDictionary<string>();
item.Add("abc", "def");
item.Add("ghi", new List<UrlStatus> {UrlStatus.A, UrlStatus.B});
var clone = Serializer.DeepClone(item);
Assert.AreEqual(2, clone.Keys.Count);
object o = clone["abc"];
Assert.AreEqual("def", clone["abc"].Value);
var list = (IList<UrlStatus>)clone["ghi"].Value;
Assert.AreEqual(2, list.Count);
Assert.AreEqual(UrlStatus.A, list[0]);
Assert.AreEqual(UrlStatus.B, list[1]);
}
With "v1", maybe simply don't make it abstract
? (workaround, not fix)
Also; there should be no need for the SerializationInfo
ctor; that is not used by protobuf-net (although you can implement protobuf-net inside BinaryFormatter
by providing this method and calling into Merge
)