且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

protobuf-net:检测到可能的递归

更新时间:2023-02-17 12:54:56

仅当在数据中看到相同的引用时(在同一路径中两次),才会引发此异常.em>仅在深度至少为 RecursionCheckDepth 时启用.这让我立即怀疑所引用的10-15深度限制,尽管protobuf处理与您计数相同的相当级别的情况并不一定.对我来说,将这个数字提高到100应该可以使它起作用-实际上,这个 RecursionCheckDepth 的存在纯粹是为了限制典型"图形中的工作而进行的优化.启用更严格的检查,以使其看起来更深.

This exception is thrown only when the same reference is seen in the data (twice in the same path), and tracking is only enabled when the depth is at least RecursionCheckDepth. Which immediately makes me suspicious of the 10-15 depth limit cited, although it is not necessarily the case that protobuf handles levels quite the same as you are counting. It does not make sense to me that raising this number to 100 should make it work - in fact, the very existence of this RecursionCheckDepth is purely an optimisation to limit the effort involved in "typical" graphs, only enabling the more rigorous checking if it starts to look deep.

但是,我谨记这可能还会暗示基于继承的处理中的一些细微错误,也许还与 AsReference 有关.我广泛而不断地使用protobuf-net,但还没有看到这样的问题.如果您有可复制的复制品,我非常希望看到它.

I am, however, mindful that this might also suggest some subtle bug in inheritance-based handling, perhaps also related to AsReference. I use protobuf-net extensively and constantly, and I haven't seen such an issue. If you have a reproducible repro I would very much like to see it.