Protobuf.net GetProto<Type>() 方法抛出未实现的异常 [英] Protobuf.net GetProto&lt;Type&gt;() method throws a not implemented exception

查看:38
本文介绍了Protobuf.net GetProto<Type>() 方法抛出未实现的异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用 protobuf 进行序列化的 .net 应用程序,我想创建一个可以与其通信的 Python 客户端.由于我的对象图非常复杂(而且我很忙lazy),我想直接从 C# 类中快速生成 .proto 文件,如下所示:

I have a .net application that serializes using protobuf, and I wanted to create a python client that can communicate with it. Since my object graph is quite complex (and I am lazy busy) I wanted to quickly generate the .proto files directly from the C# classes like this:

    string proto = Serializer.GetProto<YourType>();

不幸的是,这个方法为我抛出了一个未实现的异常:'(

Unfortunately this method is throwing a not implemented exception for me :'(

我使用的是 12 月 11 日的版本

此功能是否已删除?我应该使用更新的版本吗?或者失败了,谁能推荐一个旧版本的,我可以暂时用来创建 .proto 文件?

Has this feature been dropped? Is there a newer version I should be using? Or failing that, can anyone recommend an older version of it that I can temporarily use to create the .proto files?

谢谢 <333

推荐答案

这是很久以前重新实现的;它当然适用于 r580 及更高版本.

This was re-implemented quite a while ago now; it is certainly available in r580 and higher.

没有删除...只是不是我绝对需要发布 v2 的核心基线的一部分.重新实现在我的清单上非常重要,但类型模型在 v1 和 v2 之间发生了显着变化,需要完全重写此代码.

Not dropped... Just not part of the core baseline that I absolutely needed to release v2. It is very much on my list to re-implement, but the type-model changed significantly between v1 and v2, necessitating a full rewrite of this code.

V1 仍然可以下载,并且应该在大多数合理的情况下工作.但是,请注意 protobuf-net 允许的不仅仅是核心规范 - 继承/泛型之类的东西在 .proto 中没有任何意义,而 System.DateTime/System.Decimal 之类的青少年需要特殊处理.基本上,GetProto 可以让您大部分到达那里!

V1 is still available for download and should work in most reasonable cases. However, note that protobuf-net allows for more than the core specification - things like inheritance/generics don't have any meaning in .proto, and teen things like System.DateTime/System.Decimal need special handling. Basically, GetProto may get you most of the way there!

这篇关于Protobuf.net GetProto<Type>() 方法抛出未实现的异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆