<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Wed Feb 07 21:36:21 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-277] C# Driver does not Deserialize System.Drawing.Size</title>
                <link>https://jira.mongodb.org/browse/CSHARP-277</link>
                <project id="10041" key="CSHARP">C# Driver</project>
                    <description>&lt;p&gt;System.Drawing.Size objects are serialized properly, but not deserialized due to how System.Drawing.Size is constructed.  We wrote a custom Serializer to fix this:&lt;/p&gt;

&lt;p&gt; public class SizeSerializer : IBsonSerializer&lt;br/&gt;
    {&lt;br/&gt;
        public object Deserialize(global::MongoDB.Bson.IO.BsonReader bsonReader, Type nominalType, Type actualType, IBsonSerializationOptions options)&lt;/p&gt;
        {
            return Deserialize(bsonReader, nominalType, options);
        }

&lt;p&gt;        public object Deserialize(global::MongoDB.Bson.IO.BsonReader bsonReader, Type nominalType, IBsonSerializationOptions options)&lt;/p&gt;
        {
            if (nominalType != typeof(System.Drawing.Size)) throw new ArgumentException(&quot;Cannot serialize anything but System.Drawing.Size&quot;);
            var doc = MongoDBBson.BsonDocument.ReadFrom(bsonReader);
            return new System.Drawing.Size(doc[&quot;Width&quot;].AsInt32, doc[&quot;Height&quot;].AsInt32);
        }

&lt;p&gt;        public bool GetDocumentId(object document, out object id, out IIdGenerator idGenerator)&lt;/p&gt;
        {
            throw new NotImplementedException();
        }&lt;br/&gt;
&lt;br/&gt;
        public void Serialize(global::MongoDB.Bson.IO.BsonWriter bsonWriter, Type nominalType, object value, IBsonSerializationOptions options)&lt;br/&gt;
        {
            if (nominalType != typeof(System.Drawing.Size)) throw new ArgumentException(&quot;Cannot serialize anything but System.Drawing.Size&quot;);
            var ser = new BsonClassMapSerializer();
            ser.Serialize(bsonWriter, nominalType, value, options);
        }&lt;br/&gt;
&lt;br/&gt;
        public void SetDocumentId(object document, object id)&lt;br/&gt;
        {            throw new NotImplementedException();        }
&lt;p&gt;    }&lt;/p&gt;</description>
                <environment>.Net 4</environment>
        <key id="20003">CSHARP-277</key>
            <summary>C# Driver does not Deserialize System.Drawing.Size</summary>
                <type id="1" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14703&amp;avatarType=issuetype">Bug</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="9">Done</resolution>
                                        <assignee username="sridhar">Sridhar Nanjundeswaran</assignee>
                                    <reporter username="josefresno">Joseph A Freeman</reporter>
                        <labels>
                            <label>serialization</label>
                    </labels>
                <created>Thu, 21 Jul 2011 23:38:57 +0000</created>
                <updated>Thu, 2 Apr 2015 18:28:21 +0000</updated>
                            <resolved>Mon, 12 Sep 2011 19:07:57 +0000</resolved>
                                    <version>1.1</version>
                                    <fixVersion>1.2</fixVersion>
                                    <component>Feature Request</component>
                                        <votes>0</votes>
                                    <watches>0</watches>
                                                                                                                <comments>
                            <comment id="53519" author="sridhar" created="Mon, 12 Sep 2011 19:07:57 +0000"  >&lt;p&gt;Added custom serializer and register&lt;/p&gt;</comment>
                            <comment id="44084" author="josefresno" created="Fri, 22 Jul 2011 17:56:31 +0000"  >&lt;p&gt;Great, thanks!&lt;/p&gt;</comment>
                            <comment id="44075" author="rstam" created="Fri, 22 Jul 2011 17:43:44 +0000"  >&lt;p&gt;Sorry. I jumped to the conclusion that it was a .NET 4 datatype without even thinking about it because in the Details section you listed .NET 4 as the environment.&lt;/p&gt;

&lt;p&gt;I am rescheduling this for version 1.2 of the driver. It&apos;s hard to find all the .NET types that people would like to serialize, so let us know if there are more. Lots of them will serialize anyway using the AutoMap feature of BsonClassMapSerializer, but some (like this one) need special treatment.&lt;/p&gt;</comment>
                            <comment id="44074" author="josefresno" created="Fri, 22 Jul 2011 17:37:17 +0000"  >&lt;p&gt;System.Drawing.Size is not a .Net 4 feature (1.1?). I ran the same test in a 3.5 environment and the c# driver still does not deserialize System.Drawing.Size objects.&lt;/p&gt;</comment>
                            <comment id="44009" author="rstam" created="Fri, 22 Jul 2011 14:21:45 +0000"  >&lt;p&gt;Right now we are targeting .NET 3.5 as the required .NET version. At some point we will begin to add .NET 4 features. We haven&apos;t quite decided how to do this. Options include: factoring the .NET 4 specific features into a separate DLL that users of .NET 3.5 would not reference, using conditional compilation to produce two versions of the driver, or making .NET 4 the minimum requirement (might be an issue with Mono?).&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|hrh8nz:</customfieldvalue>

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