<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Wed Feb 07 21:41:59 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-2238] Make BsonSerializerRegistry.RegisterSerializer idempotent</title>
                <link>https://jira.mongodb.org/browse/CSHARP-2238</link>
                <project id="10041" key="CSHARP">C# Driver</project>
                    <description>&lt;p&gt;Right now, if I register the same BsonSerializer twice, I&apos;ll get an exception saying that a BsonSerializer has already been registered for that type.&lt;/p&gt;

&lt;p&gt;I&apos;m running my tests using XUnit, and a few of them pass through the part of my project that registers a couple of custom serializers. Even though each only passes through this code once, when ran together, the static nature of BsonSerializer somehow causes them to interfere with each other, throwing the &quot;There is already a serializer registered for type ...&quot; exception (thrown &lt;a href=&quot;https://github.com/mongodb/mongo-csharp-driver/blob/ec74978f7e827515f29cc96fba0c727828e8df7c/src/MongoDB.Bson/Serialization/BsonSerializerRegistry.cs#L107&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;here&lt;/a&gt;).&lt;/p&gt;

&lt;p&gt;It seems that the API would be more developer friendly if this method would allow the same serializer to be registered twice. A potential fix would be to, if failing to add it to the dictionary, check if it already exists in the dictionary, and, if so, do nothing (instead of throwing).&lt;/p&gt;

&lt;p&gt;I&apos;m happy to do a pull request if necessary.&lt;/p&gt;</description>
                <environment>MongoDB Driver 2.5</environment>
        <key id="526640">CSHARP-2238</key>
            <summary>Make BsonSerializerRegistry.RegisterSerializer idempotent</summary>
                <type id="4" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14710&amp;avatarType=issuetype">Improvement</type>
                                            <priority id="4" iconUrl="https://jira.mongodb.org/images/icons/priorities/minor.svg">Minor - P4</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="2">Won&apos;t Fix</resolution>
                                        <assignee username="vincent.kam@mongodb.com">Vincent Kam</assignee>
                                    <reporter username="Yax">Josh Yaxley [X]</reporter>
                        <labels>
                    </labels>
                <created>Fri, 13 Apr 2018 15:36:50 +0000</created>
                <updated>Wed, 30 Jan 2019 20:32:59 +0000</updated>
                            <resolved>Wed, 30 Jan 2019 20:32:59 +0000</resolved>
                                                                                        <votes>0</votes>
                                    <watches>1</watches>
                                                                                                                <comments>
                            <comment id="2132548" author="vincent.kam" created="Wed, 30 Jan 2019 20:32:35 +0000"  >&lt;p&gt;Hi &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=Yax&quot; class=&quot;user-hover&quot; rel=&quot;Yax&quot;&gt;Yax&lt;/a&gt;,&lt;/p&gt;

&lt;p&gt;Thank you for your ticket. I&apos;m sorry to hear about your testing frustrations. You are of course correct that attempting to register a serializer twice for a given type results in an exception being thrown, and it would be nice if we could somehow detect when a given serializer is identical to an already registered serializer. However, unfortunately, determining whether two serializers are equal is non-trivial, except in the case where they happen to be the same object.&#160; For now, I can only suggest that you refactor the project&apos;s code so that the serializer is only registered once, perhaps by using a static constructor, a lazily initialized variable, or simply using a booelan to track whether a serializer for a given type has already been registered.&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;

&lt;p&gt;Kind regards,&lt;/p&gt;

&lt;p&gt;Vincent&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;</comment>
                    </comments>
                    <attachments>
                    </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|htmc67:</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>