<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Wed Feb 07 21:44:54 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-3288] MongoDB.Bson.Decimal128 doesn&apos;t implement GetHashCode correctly</title>
                <link>https://jira.mongodb.org/browse/CSHARP-3288</link>
                <project id="10041" key="CSHARP">C# Driver</project>
                    <description>&lt;p&gt;The GetHashCode implementation of MongoDB.Bson.Decimal128 uses the low and the high bytes to calculate a hashcode. This is problematic, because the standard allows for multiple representations of the same number. For example,&lt;br/&gt;
_high: 6916966077687660544, _low: 10 represents 1.0m&lt;br/&gt;
_high: 1, _low: 0 represents 1&lt;/p&gt;

&lt;p&gt;This is correctly handled in the Equals implementation and `((Decimal128)1.0m).Equals((Decimal128)1)` returns `true`, however `((Decimal128)1.0m).GetHashCode().Equals(((Decimal128)1).GetHashCode())` returns `false`. The most obvious issue that this causes is that a HashSet of Decimal128 values will contain duplicates.&lt;/p&gt;

&lt;p&gt;This is slightly affecting the Realm .NET SDK, which is in the process of adding support for a collection with Set-like semantics. When an object containing such a collection is unmanaged, it uses a HashSet to store the values. Once it gets added to the Realm database, we use a C++ implementation of the collection, which correctly detects 1.0 and 1 as duplicates and only stores one of them. From a user&apos;s perspective, it can be surprising that adding an object to the database changes the number of items in the collection.&lt;/p&gt;

&lt;p&gt;Support for `ISet&amp;lt;T&amp;gt;` properties in Realm .NET will ship toward end of January 2021 and it would be nice, but by no means a deal breaker, to have a fix for this issue. We don&apos;t expect everyone to suddenly start using sets, and of those, only a small percentage will need to use Decimal128, so I don&apos;t imagine we&apos;ll start getting swarmed with bug reports.  &lt;/p&gt;</description>
                <environment></environment>
        <key id="1565767">CSHARP-3288</key>
            <summary>MongoDB.Bson.Decimal128 doesn&apos;t implement GetHashCode correctly</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="10038" iconUrl="https://jira.mongodb.org/images/icons/subtask.gif" description="">Backlog</status>
                    <statusCategory id="2" key="new" colorName="default"/>
                                    <resolution id="-1">Unresolved</resolution>
                                        <assignee username="-1">Unassigned</assignee>
                                    <reporter username="nikola.irinchev@mongodb.com">Nikola Irinchev</reporter>
                        <labels>
                    </labels>
                <created>Thu, 10 Dec 2020 21:05:30 +0000</created>
                <updated>Thu, 31 Mar 2022 00:53:34 +0000</updated>
                                            <version>2.11.5</version>
                                                    <component>BSON</component>
                                        <votes>0</votes>
                                    <watches>2</watches>
                                                                                                                <comments>
                            <comment id="3534730" author="nikola.irinchev" created="Thu, 17 Dec 2020 17:30:35 +0000"  >&lt;p&gt;Hey &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=mikalai.mazurenka&quot; class=&quot;user-hover&quot; rel=&quot;mikalai.mazurenka&quot;&gt;mikalai.mazurenka&lt;/a&gt; thanks for the suggestions. I&apos;m not sure if the Realm team will have the capacity to work on this ticket this quarter, but will let you know if we take it up. &lt;/p&gt;</comment>
                            <comment id="3534297" author="mikalai.mazurenka" created="Thu, 17 Dec 2020 14:37:33 +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;br/&gt;
Thank you for reporting this bug.&lt;br/&gt;
You can provide a PR with the improvement if you have a solution for the issue which does not affect the performance.&lt;br/&gt;
As a temporary workaround I would suggest using custom&#160;&lt;tt&gt;IEqualityComparer&lt;/tt&gt;&#160;for&#160;&lt;tt&gt;HashSet&lt;/tt&gt;&#160;(e.g. with&#160;&lt;tt&gt;GetHashCode(Decimal128 d) =&amp;gt;&#160;((decimal)d).GetHashCode())&lt;/tt&gt;. There&apos;s also an option to use custom tree structure which doesn&apos;t use &lt;tt&gt;GetHashCode&lt;/tt&gt; instead of &lt;tt&gt;HashSet&lt;/tt&gt; if that is suitable.&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|hy79o7:</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>