<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Wed Feb 07 21:38:31 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-1048] Concrete implementations of abstract members do not appear in the DeclaredMemberMaps collections as of 1.9</title>
                <link>https://jira.mongodb.org/browse/CSHARP-1048</link>
                <project id="10041" key="CSHARP">C# Driver</project>
                    <description>&lt;p&gt;Looks like I am having a breaking change in 1.9 up from 1.8.3.&lt;/p&gt;

&lt;p&gt;I have an abstract base class with an &#8220;Id&#8221; property:&lt;br/&gt;
public abstract string Id &lt;/p&gt;
{ get; set; }&lt;br/&gt;
&lt;br/&gt;
In my standard model, that string is given an ObjectId string representation. However, if I have a model that implements IScenario that Id stays as a unique string representation.&lt;br/&gt;
&lt;br/&gt;
In 1.9, this abstract Id column does not appear in my concrete type&#8217;s DeclaredMemberMaps.&lt;br/&gt;
&lt;br/&gt;
Example:&lt;br/&gt;
&lt;br/&gt;
&lt;span class=&quot;error&quot;&gt;&amp;#91;TestClass&amp;#93;&lt;/span&gt;&lt;br/&gt;
    public class ModelMapTests&lt;br/&gt;
    {&lt;br/&gt;
        public abstract class MyBase { public abstract string Id { get; set; }
&lt;p&gt; }&lt;br/&gt;
        public class MyConcrete : MyBase { public override string Id &lt;/p&gt;
{ get; set; }
&lt;p&gt; }&lt;/p&gt;

&lt;p&gt;        public class AbstractColumnConvention : IClassMapConvention&lt;br/&gt;
        {&lt;br/&gt;
                 public void Apply(BsonClassMap classMap)&lt;br/&gt;
                 {&lt;br/&gt;
                if(classMap.ClassType == typeof(MyConcrete))&lt;/p&gt;
                {
                              Assert.IsTrue(classMap.DeclaredMemberMaps.Any(m =&amp;gt; m.MemberName == &quot;Id&quot;));
                }
&lt;p&gt;                 }&lt;/p&gt;

&lt;p&gt;            public string Name&lt;br/&gt;
            {&lt;br/&gt;
                get &lt;/p&gt;
{ return &quot;Abstract Column Convention&quot;; }
&lt;p&gt;            }&lt;/p&gt;

&lt;p&gt;        }&lt;/p&gt;

&lt;p&gt;        &lt;span class=&quot;error&quot;&gt;&amp;#91;TestMethod&amp;#93;&lt;/span&gt;&lt;br/&gt;
        public void ConcreteTypeHasAbstractFields()&lt;br/&gt;
        {&lt;br/&gt;
            var conventions = new ConventionPack();&lt;br/&gt;
            conventions.Add(new AbstractColumnConvention());&lt;/p&gt;

&lt;p&gt;            ConventionRegistry.Register(&quot;My Conventions&quot;, conventions, t =&amp;gt;&lt;br/&gt;
            &lt;/p&gt;
{
                return t.IsAssignableFrom(typeof(MyConcrete));
            }
&lt;p&gt;);&lt;/p&gt;

&lt;p&gt;            BsonClassMap.LookupClassMap(typeof(MyConcrete));&lt;br/&gt;
        }&lt;br/&gt;
    }&lt;/p&gt;

&lt;p&gt;In 1.8.3 Id was found when mapping MyConcrete. In 1.9 it is not found in MyConcrete, which prevents me from mapping things properly (i.e. how I mapped them under 1.8.3).&lt;/p&gt;</description>
                <environment></environment>
        <key id="154414">CSHARP-1048</key>
            <summary>Concrete implementations of abstract members do not appear in the DeclaredMemberMaps collections as of 1.9</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="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="2">Won&apos;t Fix</resolution>
                                        <assignee username="james.kovacs@mongodb.com">James Kovacs</assignee>
                                    <reporter username="grexican">Eli Gassert</reporter>
                        <labels>
                    </labels>
                <created>Sat, 23 Aug 2014 10:41:42 +0000</created>
                <updated>Wed, 9 Nov 2022 18:47:54 +0000</updated>
                            <resolved>Wed, 9 Nov 2022 18:47:54 +0000</resolved>
                                    <version>1.9.2</version>
                                                    <component>Serialization</component>
                                        <votes>0</votes>
                                    <watches>3</watches>
                                                                                                                <comments>
                            <comment id="4968077" author="james.kovacs" created="Wed, 9 Nov 2022 18:47:31 +0000"  >&lt;p&gt;Investigating whether this admittedly old serialization issue is still present in the 2.18.0 driver...&lt;/p&gt;

&lt;p&gt;The root cause of the issue is that when the custom convention is run, the &lt;tt&gt;BsonMemberMap&lt;/tt&gt; for the &lt;tt&gt;Id&lt;/tt&gt; property has not been instantiated. Since the &lt;tt&gt;Id&lt;/tt&gt; member is defined on the base class, the &lt;tt&gt;BsonMemberMap&lt;/tt&gt; is instantiated when the base class is mapped, which occurs when &lt;tt&gt;BsonMemberMap&amp;lt;MyConcrete&amp;gt;&lt;/tt&gt; is frozen. The &lt;tt&gt;BsonMemberMap&lt;/tt&gt; for the &lt;tt&gt;Id&lt;/tt&gt; property is then copied from parent to child while freezing &lt;tt&gt;BsonMemberMap&amp;lt;MyConcrete&amp;gt;&lt;/tt&gt;.&lt;/p&gt;

&lt;p&gt;This appears to have been a change in behaviour between 1.8.3 and 1.9.0. Given that the latest driver is 2.18.0, it would be a breaking change for many users to revert to the old behaviour. I&apos;m going to close this ticket as won&apos;t fix. If anyone is having problems with the new mapping order, we request that you open a new ticket so we can investigate further.&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|hrax9r:</customfieldvalue>

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