<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Wed Feb 07 21:48:51 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-4637] Error in deserializing Decimal stored as object in driver 2.19</title>
                <link>https://jira.mongodb.org/browse/CSHARP-4637</link>
                <project id="10041" key="CSHARP">C# Driver</project>
                    <description>&lt;h4&gt;&lt;a name=&quot;Summary&quot;&gt;&lt;/a&gt;Summary&lt;/h4&gt;

&lt;p&gt;&lt;em&gt;After upgrading to driver 2.19 we noticed integration test starts failing. The reason is in how the driver changed serialization of Decimal when saved as object.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;We have a .NET type that has a type Value that contains an Object, then we can store different type and Bson Serialization does the magic. With old version of the driver here is how data is stored in MongoDb&lt;/p&gt;

&lt;p&gt;&lt;tt&gt;&quot;Value&quot; : {&lt;/tt&gt;&lt;br/&gt;
&lt;tt&gt;&#160; &#160; &#160;&quot;_t&quot; : &quot;System.Decimal&quot;,&lt;/tt&gt;&lt;br/&gt;
&lt;tt&gt;&#160; &#160; &#160;&quot;_v&quot; : &quot;12&quot;&lt;/tt&gt;&lt;br/&gt;
&lt;tt&gt;},&lt;/tt&gt;&lt;/p&gt;

&lt;p&gt;When the data is deserialized we have a System.Decimal with value 12 in the property. Upgrading to 2.19 version of the driver we have this in the database&lt;/p&gt;

&lt;p&gt;&lt;tt&gt;&#160;&quot;Value&quot; : NumberDecimal(&quot;12&quot;),&lt;/tt&gt;&lt;/p&gt;

&lt;p&gt;And the&#160;&lt;b&gt;problem is that after deserialization we have value property with an object of type&lt;/b&gt; &lt;b&gt;MongoDb.Bson.Decimal128.&lt;/b&gt;&#160;This breaks the software because it cannot be casted to decimal.&lt;/p&gt;

&lt;p&gt;As you can see the check &quot;is Decimal&quot; fails also it cannot be casted to Decimal, but we need to use Convert.ToDecimal(). This is actually breaking our software that is based on pure .NET type checking.&lt;/p&gt;

&lt;p&gt;&lt;span class=&quot;image-wrap&quot; style=&quot;&quot;&gt;&lt;img src=&quot;https://jira.mongodb.org/secure/attachment/448151/448151_image-2023-05-05-11-22-32-577.png&quot; style=&quot;border: 0px solid black&quot; /&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;From my point of view Serialization is broken because I save object with a decimal and I got back object of Bson.Decimal128.&lt;/p&gt;
&lt;h4&gt;&lt;a name=&quot;Versionofdriver2.19&quot;&gt;&lt;/a&gt;Version of driver 2.19&lt;/h4&gt;
&lt;h4&gt;&lt;a name=&quot;HowtoReproduce&quot;&gt;&lt;/a&gt;How to Reproduce&lt;/h4&gt;

&lt;p&gt;MongoTest sut = new MongoTest() { Value = 12M };&lt;br/&gt;
Console.WriteLine(sut.Value is Decimal);&lt;br/&gt;
var serialized = sut.ToBson();&lt;br/&gt;
var deserialized = BsonSerializer.Deserialize&amp;lt;MongoTest&amp;gt;(serialized);&lt;br/&gt;
Console.WriteLine(deserialized.Value is Decimal);&lt;/p&gt;

&lt;p&gt;public class MongoTest&#160;&lt;/p&gt;
{
&#160; &#160; public Object Value \{ get; set; }
&lt;p&gt;}&lt;/p&gt;

&lt;p&gt;As you can see from the above code, I serialize an object with a decimal in the Value property, when I deserialize I have an internal class that is not Decimal. This actually breaks serialization.&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;</description>
                <environment></environment>
        <key id="2332982">CSHARP-4637</key>
            <summary>Error in deserializing Decimal stored as object in driver 2.19</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="3">Duplicate</resolution>
                                        <assignee username="robert@mongodb.com">Robert Stam</assignee>
                                    <reporter username="alkampfer@nablasoft.com">Gian Maria Ricci</reporter>
                        <labels>
                    </labels>
                <created>Fri, 5 May 2023 09:29:57 +0000</created>
                <updated>Wed, 10 May 2023 00:55:15 +0000</updated>
                            <resolved>Wed, 10 May 2023 00:55:15 +0000</resolved>
                                                                                        <votes>0</votes>
                                    <watches>4</watches>
                                                                                                                <comments>
                            <comment id="5413202" author="rstam" created="Tue, 9 May 2023 23:34:14 +0000"  >&lt;p&gt;Please see &lt;a href=&quot;https://jira.mongodb.org/browse/CSHARP-4648&quot; title=&quot;Standardize handling of decimal vs Decimal128&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CSHARP-4648&quot;&gt;&lt;del&gt;CSHARP-4648&lt;/del&gt;&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="5412061" author="james.kovacs" created="Tue, 9 May 2023 16:29:26 +0000"  >&lt;p&gt;Hi, &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=alkampfer%40nablasoft.com&quot; class=&quot;user-hover&quot; rel=&quot;alkampfer@nablasoft.com&quot;&gt;alkampfer@nablasoft.com&lt;/a&gt;,&lt;/p&gt;

&lt;p&gt;Thank you for raising this issue. It has the same underlying root cause as &lt;a href=&quot;https://jira.mongodb.org/browse/CSHARP-4636&quot; title=&quot;System.Decimal serialization/deserialization is contains breaking changes&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CSHARP-4636&quot;&gt;&lt;del&gt;CSHARP-4636&lt;/del&gt;&lt;/a&gt;. We didn&apos;t intend to introduce breaking changes with the decimal serialization fix &lt;a href=&quot;https://jira.mongodb.org/browse/CSHARP-4496&quot; title=&quot;JsonReader fails with BsonInternalException when trying to deserialize Decimal128&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CSHARP-4496&quot;&gt;&lt;del&gt;CSHARP-4496&lt;/del&gt;&lt;/a&gt;. We are currently working on a fix, which we plan to release in 2.19.2.&lt;/p&gt;

&lt;p&gt;Sincerely,&lt;br/&gt;
James&lt;/p&gt;</comment>
                            <comment id="5403266" author="JIRAUSER1269368" created="Fri, 5 May 2023 09:38:58 +0000"  >&lt;p&gt;&#160;It seems related to &lt;a href=&quot;https://jira.mongodb.org/browse/CSHARP-4636&quot; title=&quot;System.Decimal serialization/deserialization is contains breaking changes&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CSHARP-4636&quot;&gt;&lt;del&gt;CSHARP-4636&lt;/del&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Introduced with &lt;a href=&quot;https://jira.mongodb.org/browse/CSHARP-4496&quot; class=&quot;external-link&quot; rel=&quot;nofollow&quot;&gt;https://jira.mongodb.org/browse/CSHARP-4496&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="5403255" author="JIRAUSER1263145" created="Fri, 5 May 2023 09:30:00 +0000"  >&lt;p&gt;Hi &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=alkampfer%40nablasoft.com&quot; class=&quot;user-hover&quot; rel=&quot;alkampfer@nablasoft.com&quot;&gt;alkampfer@nablasoft.com&lt;/a&gt;, thank you for reporting this issue! The team will look into it and get back to you soon. &lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10010">
                    <name>Duplicate</name>
                                                                <inwardlinks description="is duplicated by">
                                        <issuelink>
            <issuekey id="2336066">CSHARP-4648</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                                                <inwardlinks description="is related to">
                                        <issuelink>
            <issuekey id="2336066">CSHARP-4648</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                    </issuelinks>
                <attachments>
                            <attachment id="448151" name="image-2023-05-05-11-22-32-577.png" size="25681" author="alkampfer@nablasoft.com" created="Fri, 5 May 2023 09:22:31 +0000"/>
                    </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_14266" key="com.atlassian.jira.plugin.system.customfieldtypes:textarea">
                        <customfieldname>Documentation Changes Summary</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>&lt;p&gt;1.  What would you like to communicate to the user about this feature?&lt;br/&gt;
2.  Would you like the user to see examples of the syntax and/or executable code and its output?&lt;br/&gt;
3.  Which versions of the driver/connector does this apply to?&lt;/p&gt;</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|i1q4v4:</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>