<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Wed Feb 07 21:36:22 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-285] Decimal serialization/deserialization should not be affected by locale</title>
                <link>https://jira.mongodb.org/browse/CSHARP-285</link>
                <project id="10041" key="CSHARP">C# Driver</project>
                    <description>&lt;p&gt;The decimal separator in my regional settings is a comma &quot;,&quot;. When I store decimal variables, the driver saves them as string (which seems to be by design). But the problem is that the string contains a comma for the separator and it throws an exception when the object is deserialized. For example, the number 3.25 appears as the string &quot;3,25&quot; in the database and won&apos;t deserialize.&lt;/p&gt;

&lt;p&gt;Also, I tried to add &lt;span class=&quot;error&quot;&gt;&amp;#91;BsonRepresentation(BsonType.Double)&amp;#93;&lt;/span&gt;, but the representation in the database is still a string containing a comma. This may be another bug by itself.&lt;/p&gt;

&lt;p&gt;Here&apos;s the stack trace of one of my unit test failing:&lt;/p&gt;

&lt;p&gt;System.FormatException : Input string was not in a correct format.&lt;br/&gt;
at System.Number.StringToNumber(String str, NumberStyles options, ref NumberBuffer number, NumberFormatInfo info, Boolean parseDecimal)&lt;br/&gt;
at System.Number.ParseDecimal(String value, NumberStyles options, NumberFormatInfo numfmt)&lt;br/&gt;
at MongoDB.Bson.Serialization.Serializers.DecimalSerializer.Deserialize(BsonReader bsonReader, Type nominalType, IBsonSerializationOptions options) in C:\work\10gen\mongodb\mongo-csharp-driver\Bson\Serialization\Serializers\NetPrimitiveSerializers.cs: line 744&lt;br/&gt;
at MongoDB.Bson.Serialization.Serializers.BsonBaseSerializer.Deserialize(BsonReader bsonReader, Type nominalType, Type actualType, IBsonSerializationOptions options) in C:\work\10gen\mongodb\mongo-csharp-driver\Bson\Serialization\Serializers\BsonBaseSerializer.cs: line 69&lt;br/&gt;
at MongoDB.Bson.Serialization.BsonClassMapSerializer.DeserializeMember(BsonReader bsonReader, Object obj, BsonMemberMap memberMap) in C:\work\10gen\mongodb\mongo-csharp-driver\Bson\Serialization\BsonClassMapSerializer.cs: line 305&lt;br/&gt;
at MongoDB.Bson.Serialization.BsonClassMapSerializer.Deserialize(BsonReader bsonReader, Type nominalType, Type actualType, IBsonSerializationOptions options) in C:\work\10gen\mongodb\mongo-csharp-driver\Bson\Serialization\BsonClassMapSerializer.cs: line 127&lt;br/&gt;
at MongoDB.Bson.Serialization.BsonClassMapSerializer.Deserialize(BsonReader bsonReader, Type nominalType, IBsonSerializationOptions options) in C:\work\10gen\mongodb\mongo-csharp-driver\Bson\Serialization\BsonClassMapSerializer.cs: line 81&lt;br/&gt;
at MongoDB.Bson.Serialization.BsonSerializer.Deserialize(BsonReader bsonReader, Type nominalType, IBsonSerializationOptions options) in C:\work\10gen\mongodb\mongo-csharp-driver\Bson\Serialization\BsonSerializer.cs: line 217&lt;br/&gt;
at MongoDB.Driver.Internal.MongoReplyMessage`1.ReadFrom(BsonBuffer buffer, IBsonSerializationOptions serializationOptions) in C:\work\10gen\mongodb\mongo-csharp-driver\Driver\Internal\MongoReplyMessage.cs: line 94&lt;br/&gt;
at MongoDB.Driver.Internal.MongoConnection.ReceiveMessage(BsonBinaryReaderSettings readerSettings, IBsonSerializationOptions serializationOptions) in C:\work\10gen\mongodb\mongo-csharp-driver\Driver\Internal\MongoConnection.cs: line 337&lt;br/&gt;
at MongoDB.Driver.MongoCursorEnumerator`1.GetReply(MongoConnection connection, MongoRequestMessage message) in C:\work\10gen\mongodb\mongo-csharp-driver\Driver\Core\MongoCursorEnumerator.cs: line 263&lt;br/&gt;
at MongoDB.Driver.MongoCursorEnumerator`1.GetFirst() in C:\work\10gen\mongodb\mongo-csharp-driver\Driver\Core\MongoCursorEnumerator.cs: line 223&lt;br/&gt;
at MongoDB.Driver.MongoCursorEnumerator`1.MoveNext() in C:\work\10gen\mongodb\mongo-csharp-driver\Driver\Core\MongoCursorEnumerator.cs: line 126&lt;br/&gt;
at System.Linq.Enumerable.FirstOrDefault(IEnumerable`1 source)&lt;br/&gt;
at MongoDB.Driver.MongoCollection.FindOneAs(IMongoQuery query) in C:\work\10gen\mongodb\mongo-csharp-driver\Driver\Core\MongoCollection.cs: line 493&lt;br/&gt;
at MongoDB.Driver.MongoCollection.FindOneByIdAs(BsonValue id) in C:\work\10gen\mongodb\mongo-csharp-driver\Driver\Core\MongoCollection.cs: line 529&lt;br/&gt;
at MongoDB.Driver.MongoCollection`1.FindOneById(BsonValue id) in C:\work\10gen\mongodb\mongo-csharp-driver\Driver\Core\MongoCollection.cs: line 1462&lt;br/&gt;
at Domain.Storage.MongoSession.Single(ObjectId id) in MongoSession.cs: line 81&lt;br/&gt;
at WebApp.Test.Controllers.RatingControllerTest.Rate_RecalculatesRating() in RatingControllerTest.cs: line 131 &lt;/p&gt;</description>
                <environment>Windows 7, .NET 4, C# driver v1.1, environment setting for decimal separator is a comma &amp;quot;,&amp;quot;</environment>
        <key id="20146">CSHARP-285</key>
            <summary>Decimal serialization/deserialization should not be affected by locale</summary>
                <type id="1" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14703&amp;avatarType=issuetype">Bug</type>
                                            <priority id="5" iconUrl="https://jira.mongodb.org/images/icons/priorities/trivial.svg">Trivial - P5</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="9">Done</resolution>
                                        <assignee username="robert@mongodb.com">Robert Stam</assignee>
                                    <reporter username="antoineleclair">Antoine Leclair</reporter>
                        <labels>
                    </labels>
                <created>Tue, 26 Jul 2011 15:16:17 +0000</created>
                <updated>Thu, 2 Apr 2015 18:28:18 +0000</updated>
                            <resolved>Tue, 26 Jul 2011 16:00:53 +0000</resolved>
                                    <version>1.1</version>
                                    <fixVersion>1.1</fixVersion>
                                                        <votes>0</votes>
                                    <watches>1</watches>
                                                                                                                <comments>
                            <comment id="44540" author="rstam" created="Tue, 26 Jul 2011 16:00:34 +0000"  >&lt;p&gt;No problem. I&apos;m happy to check it out. Could easily have been a real problem. Let me know if after further review you find anything else you want me to look at.&lt;/p&gt;</comment>
                            <comment id="44537" author="antoineleclair" created="Tue, 26 Jul 2011 15:57:54 +0000"  >&lt;p&gt;I tested your code, it works fine.&lt;/p&gt;

&lt;p&gt;I am terribly sorry, it must be some kind of abstraction layer we use that caused the bug.&lt;/p&gt;</comment>
                            <comment id="44533" author="rstam" created="Tue, 26 Jul 2011 15:38:36 +0000"  >&lt;p&gt;I can&apos;t reproduce this. When Decimal is converted to a string it uses XmlConvert.ToString which is not culture sensitive. String is the default representation for Decimal because BSON has no equivalent data type.&lt;/p&gt;

&lt;p&gt;Here&apos;s my test program:&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://www.pastie.org/2274489&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://www.pastie.org/2274489&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And here&apos;s the output (note that the string representation of Decimal is using a &quot;.&quot; even though the CurrentCulture was set to German):&lt;/p&gt;

{ &quot;_id&quot; : ObjectId(&quot;4e2ede14e447ad2bd0ed5d78&quot;), &quot;Culture&quot; : &quot;German (Germany)&quot;, &quot;Decimal&quot; : &quot;1.23&quot; }
&lt;p&gt;Press Enter to continue&lt;/p&gt;

&lt;p&gt;Changing the representation in your code does not affect existing data, so any strings with commas already in the database are there to stay and will have to be either removed or fixed using some other process.&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|hrh8mn:</customfieldvalue>

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