Note that there are some explanatory texts on larger screens.

plurals
  1. POProtobuf-net possible recursion detected: serialize children and parents
    primarykey
    data
    text
    <p>I am new to serialization in general, and even newer to protobuf. Here is my problem, I have these classes:</p> <pre><code>[ProtoContract] class Controle { [ProtoMember(1, AsReference=true)] public HashSet&lt;Controle&gt; ControlesInternes { get; set; } [ProtoMember(2)] public string TypeControle { get; set; } [ProtoMember(3)] public Dictionary&lt;string, string&gt; Attributs { get; set; } [ProtoMember(4)] public int Ligne { get; set; } [ProtoMember(5)] public string InnerText { get; set; } [ProtoMember(6)] public Controle Parent { get; set; } public Controle() { ControlesInternes = new HashSet&lt;Controle&gt;(); Attributs = new Dictionary&lt;string, string&gt;(); } } </code></pre> <hr> <pre><code>[ProtoContract(SkipConstructor=true)] class PageAspx { [ProtoMember(1)] public string PrefixeControleOnilait { get; set; } [ProtoMember(2, AsReference = true)] public HashSet&lt;Controle&gt; Controles { get; set; } private string CheminTmp; private string nomFichier; [ProtoMember(3)] public string NomFichier { get { return nomFichier; } set { nomFichier = value; } } private string titre; [ProtoMember(4)] public string Titre { get { return titre; } set { titre = value; } } public PageAspx() { } public PageAspx(string pNomFichier) { this.NomFichier = pNomFichier; this.Controles = new HashSet&lt;Controle&gt;(); } } </code></pre> <p>When trying to serialize, I get a "possible recursion detected" error. </p> <p>But basically, my code lists all controls in an aspx page, and they hierarchy (children, parents). That means that after my "PageAspx" object is made, it contains all the controls of the page, and for each of them, its parent and its children if it has any. When I don't serialize the member <code>ControlesInternes</code>, the serialization goes well. But I need this information.</p> <p>How can I save these datas using protobuf?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload