<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Wed Feb 07 21:46:03 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-3703] NullReferenceException when serializing an Id without a getter</title>
                <link>https://jira.mongodb.org/browse/CSHARP-3703</link>
                <project id="10041" key="CSHARP">C# Driver</project>
                    <description>&lt;p&gt;If an object has an Id property without a getter, attempting to serialize it to json will throw a NullReferenceException. This is caused by not checking if `GetMethod` is null here: &lt;a href=&quot;https://github.com/mongodb/mongo-csharp-driver/blob/c8e76e5dd3c11683b5d99f56374754eb1e7ec792/src/MongoDB.Bson/Serialization/Conventions/NamedIdMemberConvention.cs#L114-L118&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-csharp-driver/blob/c8e76e5dd3c11683b5d99f56374754eb1e7ec792/src/MongoDB.Bson/Serialization/Conventions/NamedIdMemberConvention.cs#L114-L118&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;I&apos;ve attached a trivial repro that you can run and test locally.&lt;/p&gt;</description>
                <environment></environment>
        <key id="1767544">CSHARP-3703</key>
            <summary>NullReferenceException when serializing an Id without a getter</summary>
                <type id="1" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14703&amp;avatarType=issuetype">Bug</type>
                                            <priority id="10300" iconUrl="https://jira.mongodb.org/images/icons/priorities/medium.svg">Unknown</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="13201">Fixed</resolution>
                                        <assignee username="james.kovacs@mongodb.com">James Kovacs</assignee>
                                    <reporter username="nikola.irinchev@mongodb.com">Nikola Irinchev</reporter>
                        <labels>
                    </labels>
                <created>Thu, 3 Jun 2021 14:59:09 +0000</created>
                <updated>Sat, 28 Oct 2023 11:47:39 +0000</updated>
                            <resolved>Fri, 4 Jun 2021 18:19:09 +0000</resolved>
                                                    <fixVersion>2.13.0</fixVersion>
                                                        <votes>0</votes>
                                    <watches>2</watches>
                                                                                                                <comments>
                            <comment id="3860720" author="james.kovacs" created="Fri, 4 Jun 2021 19:22:20 +0000"  >&lt;p&gt;Thanks for providing the context. That&apos;s helpful to know. I was wondering how you got yourself into a situation when your Id didn&apos;t have a getter, but Unity stripping unused methods/properties makes a lot of sense.&lt;/p&gt;</comment>
                            <comment id="3860646" author="nikola.irinchev" created="Fri, 4 Jun 2021 18:52:48 +0000"  >&lt;p&gt;Thanks James - I agree it&apos;s fairly awkward scenario - I hit it when compiling a Unity project where the linker had stripped the getter from my Id property. The NRE threw me off and made me think it had actually stripped something from MongoDB.Bson and it took some digging to get to the bottom of it. Since we&apos;ll be shipping Unity support for Realm soon, I figured others might run into it as well.&lt;/p&gt;</comment>
                            <comment id="3860529" author="james.kovacs" created="Fri, 4 Jun 2021 18:14:19 +0000"  >&lt;p&gt;Hi, &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=nikola.irinchev&quot; class=&quot;user-hover&quot; rel=&quot;nikola.irinchev&quot;&gt;nikola.irinchev&lt;/a&gt;,&lt;/p&gt;

&lt;p&gt;Thank you for reporting this issue. While having an Id without a getter isn&apos;t a common design choice, we shouldn&apos;t throw a &lt;tt&gt;NullReferenceException&lt;/tt&gt; when attempting to map it. We have implemented a fix, which will be available in an upcoming patch release.&lt;/p&gt;

&lt;p&gt;Sincerely,&lt;br/&gt;
James&lt;/p&gt;</comment>
                            <comment id="3860526" author="xgen-internal-githook" created="Fri, 4 Jun 2021 18:12:53 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;name&apos;: &apos;James Kovacs&apos;, &apos;email&apos;: &apos;jkovacs@post.harvard.edu&apos;, &apos;username&apos;: &apos;JamesKovacs&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/CSHARP-3703&quot; title=&quot;NullReferenceException when serializing an Id without a getter&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CSHARP-3703&quot;&gt;&lt;del&gt;CSHARP-3703&lt;/del&gt;&lt;/a&gt;: Fix NullReferenceException when Id property has no getter. (#545)&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo-csharp-driver/commit/ad0ad177e25debcef9e6f1875f24d4f2c733662a&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-csharp-driver/commit/ad0ad177e25debcef9e6f1875f24d4f2c733662a&lt;/a&gt;&lt;/p&gt;</comment>
                    </comments>
                    <attachments>
                            <attachment id="318610" name="SetterPropertyRepro.zip" size="1581" author="nikola.irinchev@mongodb.com" created="Thu, 3 Jun 2021 14:59:00 +0000"/>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                                                                                                                                                                                        <customfield id="customfield_10011" key="com.atlassian.jira.plugin.system.customfieldtypes:radiobuttons">
                        <customfieldname>Backwards Compatibility</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10038"><![CDATA[Fully Compatible]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <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|hz44rr:</customfieldvalue>

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