protobuf-net - 类型“Namespace.SomeAbstractType”只能参与一个继承层次结构(Namespace.InterfaceType)
问题描述
尝试使用 protobuf-net 进行序列化时,此错误意味着什么?
{"Type 'Namespace.SomeAbstractType' 只能参与一个继承层次结构(Namespace.InterfaceType)"}
堆栈跟踪
at ProtoBuf.Meta.RuntimeTypeModel.GetKey(Type type, Boolean demand, Boolean getBaseKey)
at ProtoBuf.Meta.ValueMember.TryGetCoreSerializer(RuntimeTypeModel model, DataFormat dataFormat, Type type, WireType& defaultWireType, Boolean asReference, Boolean dynamicType, Boolean overwriteList, Boolean allowComplexTypes)
at ProtoBuf.Meta.ValueMember.BuildSerializer()
at ProtoBuf.Meta.ValueMember.get_Serializer()
at ProtoBuf.Meta.MetaType.BuildSerializer()
at ProtoBuf.Meta.MetaType.get_Serializer()
at ProtoBuf.Meta.RuntimeTypeModel.Serialize(Int32 key, Object value, ProtoWriter dest)
at ProtoBuf.Meta.TypeModel.SerializeCore(ProtoWriter writer, Object value)
at ProtoBuf.Meta.TypeModel.Serialize(Stream dest, Object value, SerializationContext context)
at ProtoBuf.Meta.TypeModel.Serialize(Stream dest, Object value)
at ProtoBuf.Serializer.Serialize[T](Stream destination, T instance)
at Temp.Program.Main(String[] args) in D:\SOURCECODE\VISUALSTUDIO\AI\Dev\DevBranch\Temp\Program.cs:line 25
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
解决方案
推荐阅读
- javascript - Google Books API 仅显示 10 个结果。想要迭代 startIndex 以便它循环直到显示所有结果
- php - 使用 PHP 和 jQuery 的无限滚动分页只返回很少的帖子并使用加载器 gif 停止
- winforms - 使用 VS 2015 Professional 创建无需管理员权限即可运行的设置
- python - 使用 orient=records 将 Python3/Pandas 数据帧写入 JSON,但当只有一条记录时不使用数组
- ansible - 创建密码并将其写入文件
- node.js - 请求的资源(快速服务器)上不存在“Access-Control-Allow-Origin”标头
- api - 鱼壳 | 使用 curl 和 JSON 进行变量赋值的命令替换
- python - Python:将各种输出部分重定向到单独的变量
- python - 从字典 Python 中的列表中删除元素
- spring-boot - Spring Security 排除 url