我在使用Protobuf.net的项目中遇到此异常:
InvalidOperationException "Unexpected sub-type: foo"
Run Code Online (Sandbox Code Playgroud)
我有一个我要发送的类,如下所示:
class message
{
list<bar> listOfBars;
}
Run Code Online (Sandbox Code Playgroud)
foo继承了bar,但是protobuf似乎对此产生了阻碍并产生了上面的异常.这有什么办法吗?我需要能够在列表中保存所有不同的bar子类型,因此更难以/不可能采用更多类型约束的解决方案.