【发布时间】:2011-03-07 07:41:09
【问题描述】:
以下测试失败并出现此错误:
“System.InvalidOperationException:否 找到合适的默认 IB 编码。”
[ProtoContract]
public class A
{
[ProtoMember(1)]
public IB B { get; set; }
}
public interface IB
{
}
[ProtoContract]
public class B : IB
{
[ProtoMember(1)]
public int SomeProperty { get; set; }
}
[TestFixture]
public class TestFixture
{
[Test]
public void Test()
{
var a = new A {B = new B()};
using (var m = new MemoryStream())
{
Serializer.Serialize(m, a);
}
}
}
我正在使用 Protobuf.net 的这个实现:
http://code.google.com/p/protobuf-net/
我错过了什么吗?非常感谢。
【问题讨论】:
标签: c# serialization protocol-buffers protobuf-net