Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8716067
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T05:59:19+00:00 2026-06-13T05:59:19+00:00

This exception is being thrown on my test application for serializing with ProtoBuf. SceneryFile:temp.ad2

  • 0

This exception is being thrown on my test application for serializing with ProtoBuf.

SceneryFile:temp.ad2
ProtoBuf.ProtoException: Possible recursion detected (offset: 2 level(s): SceneryFile: temp.ad2
at ProtoBuf.ProtoWriter.CheckRecursionStackAndPush(Object instance( in c:\protbuf-net\protobuf-net\ProtoWriter.sc:line321

I found these other questions

protobuf-net: Possible recursion detected

Protobuf-net possible recursion detected: serialize children and parents

The depth of my tree is only 4. I looked to see if I can change the ProtoBuf.ProtoWriter.RecursionCheckDepth but I could not find a way to do that in my code.

Based on Marc’s answer to the last question I think it means by reference that the same object instance is being referred to again – so in my case the SceneryFile is referring to itself or is referred to somewhere else (actually it is the base class). It is in the sense that all the direct children hold a reference to it. The answer here seems to suggest this might be the problem:

Based on the findings of the second question above I removed the parent from being serialized and this did stop this problem.

Is there some way to allow me to keep the reference to the parent as is in the serialization or do I need to do something like use an index for the parent and then reconstruct the graph when I decompile?

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T05:59:20+00:00Added an answer on June 13, 2026 at 5:59 am

    The “recursion check depth” is an optimisation detail only: to avoid the overhead of constantly checking every object for recursion, it only checks if the depth is higher than this. It makes no difference to what is/isn’t valid.

    There are two approaches here. My preferred would be to just serialise “child” relationships, and use an after-deserialization callback that then loops over the children and sets their parent property. This is done via callback attributes, and is usually 5-ish lines of code.

    The other is to tell protobuf-net to respect references (set AsReference to true on the members). This changes the layout, making it inappropriate if you want to interop to a different (non protobuf-net) implementation.

    I can add examples of both ir either, but not on a phone!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

1) Is it possible to track the number of exceptions being thrown by application?
I get this exception on my Windows 7 64bit in application running in VS
I've started seeing an AccessViolationException being thrown in my application a several different spots.
I have MS Test unit tests that ensure that an Exception is thrown when
what this exception: System.MissingMethodException was unhandled Message: File or assembly name 'System.Windows.Forms, Version=3.5.0.0, Culture=neutral,
Several random customers get this exception every time I update my Android app. I've
I am getting this exception when trying to run my PHP unit tests: Fatal
ive got this exception. My Object looks like this: @XmlRootElement @XmlAccessorType(XmlAccessType.FIELD) public class ObjectDTO
I am getting this exception: Collection was modified; enumeration operation may not execute. Directly
I am getting this exception while running any JSP on my tomcat5.5 server.Do I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.