<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Wed Feb 07 21:36:46 UTC 2024

It is possible to restrict the fields that are returned in this document by specifying the 'field' parameter in your request.
For example, to request only the issue key and summary append 'field=key&field=summary' to the URL of your request.
-->
<rss version="0.92" >
<channel>
    <title>MongoDB Jira</title>
    <link>https://jira.mongodb.org</link>
    <description>This file is an XML representation of an issue</description>
    <language>en-us</language>    <build-info>
        <version>9.7.1</version>
        <build-number>970001</build-number>
        <build-date>13-04-2023</build-date>
    </build-info>


<item>
            <title>[CSHARP-416] StackoverflowException occours when I serialize an object witha  nhivbernate persistentbag</title>
                <link>https://jira.mongodb.org/browse/CSHARP-416</link>
                <project id="10041" key="CSHARP">C# Driver</project>
                    <description>&lt;p&gt;I&apos;m usingn mongo for logging, when I try to call ToBsonDocument on an object that is mapped with nhibernate and has a property of type IList&amp;lt;T&amp;gt;, nhibernate will create a PErsistentGenericBag&amp;lt;T&amp;gt;, and it cause a StackOverflowException when I call ToBsonDocument&lt;/p&gt;

&lt;p&gt;The exact type of the property is&lt;br/&gt;
Name = &quot;PersistentGenericBag`1&quot; FullName = &quot;NHibernate.Collection.Generic.PersistentGenericBag`1[&lt;span class=&quot;error&quot;&gt;&amp;#91;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089&amp;#93;&lt;/span&gt;]&quot;}	System.Type &lt;/p&gt;
{System.RuntimeType}

</description>
                <environment>Windows 64 bit </environment>
        <key id="34772">CSHARP-416</key>
            <summary>StackoverflowException occours when I serialize an object witha  nhivbernate persistentbag</summary>
                <type id="1" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14703&amp;avatarType=issuetype">Bug</type>
                                            <priority id="3" iconUrl="https://jira.mongodb.org/images/icons/priorities/major.svg">Major - P3</priority>
                        <status id="6" iconUrl="https://jira.mongodb.org/images/icons/statuses/closed.png" description="The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.">Closed</status>
                    <statusCategory id="3" key="done" colorName="success"/>
                                    <resolution id="9">Done</resolution>
                                        <assignee username="robert@mongodb.com">Robert Stam</assignee>
                                    <reporter username="alkampfer@nablasoft.com">Gian Maria Ricci</reporter>
                        <labels>
                    </labels>
                <created>Tue, 27 Mar 2012 10:27:40 +0000</created>
                <updated>Thu, 2 Jun 2022 14:53:17 +0000</updated>
                            <resolved>Mon, 2 Apr 2012 16:51:51 +0000</resolved>
                                    <version>1.3.1</version>
                                    <fixVersion>1.4.1</fixVersion>
                                                        <votes>0</votes>
                                    <watches>0</watches>
                                                                                                                <comments>
                            <comment id="106885" author="JIRAUSER1269368" created="Thu, 5 Apr 2012 09:08:26 +0000"  >&lt;p&gt;Thanks a lot for the quick fix &lt;img class=&quot;emoticon&quot; src=&quot;https://jira.mongodb.org/images/icons/emoticons/smile.png&quot; height=&quot;16&quot; width=&quot;16&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt;, really good work.&lt;/p&gt;</comment>
                            <comment id="105743" author="rstam" created="Mon, 2 Apr 2012 16:51:51 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/browse/CSHARP-424&quot; title=&quot;When attempting to serialize an object with circular references detect that and throw a catchable exception instead of a fatal StackOverflowException&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CSHARP-424&quot;&gt;&lt;del&gt;CSHARP-424&lt;/del&gt;&lt;/a&gt; has been implemented, so I&apos;m closing this ticket as fixed also.&lt;/p&gt;</comment>
                            <comment id="105148" author="rstam" created="Fri, 30 Mar 2012 13:46:25 +0000"  >&lt;p&gt;Thank you for your comment. I have created a new ticket &lt;a href=&quot;https://jira.mongodb.org/browse/CSHARP-424&quot; title=&quot;When attempting to serialize an object with circular references detect that and throw a catchable exception instead of a fatal StackOverflowException&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CSHARP-424&quot;&gt;&lt;del&gt;CSHARP-424&lt;/del&gt;&lt;/a&gt; for an improvement that serializing an object with circular references should result in a catchable exception instead of a fatal StackOverflowException.&lt;/p&gt;</comment>
                            <comment id="105092" author="JIRAUSER1269368" created="Fri, 30 Mar 2012 07:48:47 +0000"  >&lt;p&gt;I understand these limitation, but StackOverflowException is not catchable, and it will kill your process immediately. Since I&apos;m using MongoDb as a storage for log4net logs, to save object attached to logs, this problem makes impossibile to adopt this solution, because if someone try to log an object that has a circular reference the program shut down without any possibility to do a Try/Catch.&lt;/p&gt;

&lt;p&gt;It would be nice, for circular references, to throw some specific exception, or at least a catchable one, or being able to specify to the serializer a maximum deep of serialization.&lt;/p&gt;

&lt;p&gt;Thanks for your attenction.&lt;/p&gt;</comment>
                            <comment id="103965" author="rstam" created="Tue, 27 Mar 2012 14:21:44 +0000"  >&lt;p&gt;Not all classes can be serialized by the BsonClassMapSerializer, which works with classes that meet the following requirements:&lt;/p&gt;

&lt;p&gt;1. The class has a public no-argument constructor&lt;br/&gt;
2. All values to be serialized are exposed via get/set properties&lt;br/&gt;
3. All values to be serialized are in turn serializable&lt;br/&gt;
4. There are no circular references in the object graph to be serialized&lt;/p&gt;

&lt;p&gt;Apparently NHibernate&apos;s PersistentGenericBag doesn&apos;t meet these requirements and is therefore not serializable by the BsonClassMapSerializer. A StackOverflow during serialization usually indicates a circular reference in the object graph.&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                            <outwardlinks description="related to">
                                        <issuelink>
            <issuekey id="35090">CSHARP-424</issuekey>
        </issuelink>
                            </outwardlinks>
                                                        </issuelinktype>
                    </issuelinks>
                <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_15850" key="com.atlassian.jira.plugins.jira-development-integration-plugin:devsummary">
                        <customfieldname>Development</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hrh7v3:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10558" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>14073</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            </customfields>
    </item>
</channel>
</rss>