<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Wed Feb 07 21:42:57 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-2579] BsonSerializerRegistry does not distinguish between cached serializers and explicitly registered ones</title>
                <link>https://jira.mongodb.org/browse/CSHARP-2579</link>
                <project id="10041" key="CSHARP">C# Driver</project>
                    <description>&lt;p&gt;&lt;b&gt;BsonSerializerRegistry.RegisterSerializer&lt;/b&gt; will just put the specified serializer into its internal cache, alongside other serializers that have been created by (default) providers before. If one tries to register a serializer for a type that has been looked up previously in the AppDomain, this will lead to an exception indicating that a serializer is already registered for the type. This can be especially confusing if there is only one call of the register method in the user&apos;s codebase. I would expect the explicit registration to override the default serializer; only throwing an exception if it has been registered explicitly before.&lt;/p&gt;

&lt;p&gt;In my use case, I use a library called Hangfire alongside my own code. Hangfire will always run before my code does, calling the MongoDB driver and filling the cache of the BsonSerializerRegistry with default serializers. Although it does not explicitly register global serializers itself, this will still clash with the serializer I want to register in my code, which I think it should not.&lt;/p&gt;

&lt;p&gt;Disclaimer:&lt;br/&gt;
This is my first ticket and will be my first pull request. I hope I did not get anything fundamentally wrong, feedback will be greatly appreciated. I am especially unsure about Backwards Compatibility - I would guess this to be compatible, but could think of weird edge cases that would be broken by changing the behaviour (but I guess those cases would already be buggy as they are now).&lt;/p&gt;</description>
                <environment>Windows</environment>
        <key id="734370">CSHARP-2579</key>
            <summary>BsonSerializerRegistry does not distinguish between cached serializers and explicitly registered ones</summary>
                <type id="4" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14710&amp;avatarType=issuetype">Improvement</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="13202">Works as Designed</resolution>
                                        <assignee username="robert@mongodb.com">Robert Stam</assignee>
                                    <reporter username="dennisjaniak">Dennis Janiak</reporter>
                        <labels>
                    </labels>
                <created>Tue, 9 Apr 2019 16:21:30 +0000</created>
                <updated>Fri, 27 Oct 2023 13:24:57 +0000</updated>
                            <resolved>Thu, 2 May 2019 13:53:51 +0000</resolved>
                                    <version>2.8.0</version>
                                                    <component>BSON</component>
                    <component>Serialization</component>
                                        <votes>0</votes>
                                    <watches>2</watches>
                                                                                                                <comments>
                            <comment id="2208355" author="dennisjaniak" created="Wed, 10 Apr 2019 16:08:03 +0000"  >&lt;p&gt;Thanks for your reply - thinking about it with a &quot;fresh mind&quot;, this totally makes sense. The suggested change would be a potential source for really nasty bugs. As for me, this issue can be closed.&lt;/p&gt;

&lt;p&gt;Thanks!&lt;/p&gt;</comment>
                            <comment id="2208231" author="rstam" created="Wed, 10 Apr 2019 14:52:27 +0000"  >&lt;p&gt;This behavior is by design.&lt;/p&gt;

&lt;p&gt;It is very important that your application use a single consistent representation for every type. If we allowed you to change the registered serializer at any time then there would be no consistent definition of how a document is serialized and deserialized.&lt;/p&gt;

&lt;p&gt;It makes no difference whether a serializer was explicitly registered by an application or implicitly registered the first time it was needed and not found. Registered is registered.&lt;/p&gt;

&lt;p&gt;Applications should completely configure the serialization register &lt;b&gt;before&lt;/b&gt; any operations are performed against the database to make sure they register the desired serializers before implicit ones are registered instead.&lt;/p&gt;</comment>
                    </comments>
                    <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|hujbmv:</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>