<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Wed Feb 07 21:37:26 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-652] No serializer found for type {0} exception when using &quot;chained&quot; Linq query</title>
                <link>https://jira.mongodb.org/browse/CSHARP-652</link>
                <project id="10041" key="CSHARP">C# Driver</project>
                    <description>&lt;p&gt;See attached Test.  &lt;/p&gt;

&lt;p&gt;A detailed description of why this is a problem:&lt;/p&gt;

&lt;p&gt;In our service layer, we have methods that expose IQueryable&amp;lt;IEntity&amp;gt; values.  The intent is that other services can uses these to perform more detailed queries.  Internal to the service, we query against a collection using the concrete type (GetCollection&amp;lt;Entity&amp;gt;()) and return it as an IQueryable&amp;lt;IEntity&amp;gt;().  Enumerations against this object succeed.  However, if we do an additional query against it, we get a serialization exception.  &lt;/p&gt;
</description>
                <environment></environment>
        <key id="60192">CSHARP-652</key>
            <summary>No serializer found for type {0} exception when using &quot;chained&quot; Linq query</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="9">Done</resolution>
                                        <assignee username="-1">Unassigned</assignee>
                                    <reporter username="joe.enzminger">Joe Enzminger</reporter>
                        <labels>
                    </labels>
                <created>Fri, 21 Dec 2012 23:07:06 +0000</created>
                <updated>Tue, 28 Apr 2015 19:26:51 +0000</updated>
                            <resolved>Tue, 28 Apr 2015 19:26:50 +0000</resolved>
                                    <version>1.7</version>
                                    <fixVersion>2.1</fixVersion>
                                                        <votes>1</votes>
                                    <watches>3</watches>
                                                                                                                <comments>
                            <comment id="900154" author="craiggwilson" created="Tue, 28 Apr 2015 19:26:51 +0000"  >&lt;p&gt;This was fixed as part of &lt;a href=&quot;https://jira.mongodb.org/browse/CSHARP-601&quot; title=&quot;Linq to Aggregation Framework&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CSHARP-601&quot;&gt;&lt;del&gt;CSHARP-601&lt;/del&gt;&lt;/a&gt;.&lt;/p&gt;</comment>
                            <comment id="343085" author="craiggwilson" created="Wed, 22 May 2013 20:49:31 +0000"  >&lt;p&gt;You can see the releases we have &quot;scheduled&quot; here: &lt;a href=&quot;https://jira.mongodb.org/browse/CSHARP#selectedTab=com.atlassian.jira.plugin.system.project%3Aversions-panel&quot; class=&quot;external-link&quot; rel=&quot;nofollow&quot;&gt;https://jira.mongodb.org/browse/CSHARP#selectedTab=com.atlassian.jira.plugin.system.project%3Aversions-panel&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;I say &quot;scheduled&quot; because it is somewhat arbitrary right now.  We are working on major 2.0 release and just don&apos;t know what all that currently entails.  It is likely that the date for 1.9 will actually be 2.0 and 1.9 will come sooner.  I know that doesn&apos;t help you much, but it&apos;s the best we can do right now.  The linked ticket, &lt;a href=&quot;https://jira.mongodb.org/browse/CSHARP-601&quot; title=&quot;Linq to Aggregation Framework&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CSHARP-601&quot;&gt;&lt;del&gt;CSHARP-601&lt;/del&gt;&lt;/a&gt;, is a large refactoring, and when it&apos;s done will likely be when we release 1.9.  So, keep an eye on that ticket.&lt;/p&gt;</comment>
                            <comment id="343035" author="dhireshan" created="Wed, 22 May 2013 20:11:26 +0000"  >&lt;p&gt;Craig,&lt;/p&gt;

&lt;p&gt;Where can I find a production release schedule for version 1.9?&lt;/p&gt;

&lt;p&gt;The package page &lt;a href=&quot;http://www.nuget.org/packages/mongocsharpdriver/&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://www.nuget.org/packages/mongocsharpdriver/&lt;/a&gt;&lt;br/&gt;
shows 1.8.1 as the current release.&lt;/p&gt;


&lt;p&gt;Thanks&lt;br/&gt;
D&lt;/p&gt;</comment>
                            <comment id="337230" author="craiggwilson" created="Thu, 16 May 2013 16:35:37 +0000"  >&lt;p&gt;Joe,&lt;br/&gt;
  First, I&apos;ll attempt to fix this with the retooling of Linq.  The current implementation doesn&apos;t track the initial DocumentType throughout the query pipeline and hence has no access to that original.&lt;br/&gt;
  Second, we can&apos;t derive element names from interfaces alone.  There could be multiple implementations of an interface with different elements names for the same property.  Hence, without tracking the original document type used, we cannot discover anything from the interface alone.&lt;br/&gt;
  Track &lt;a href=&quot;https://jira.mongodb.org/browse/CSHARP-601&quot; title=&quot;Linq to Aggregation Framework&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CSHARP-601&quot;&gt;&lt;del&gt;CSHARP-601&lt;/del&gt;&lt;/a&gt; for this fix.&lt;/p&gt;</comment>
                            <comment id="299765" author="joe.enzminger" created="Wed, 27 Mar 2013 13:18:01 +0000"  >&lt;p&gt;The serialization details of the interface really shouldn&apos;t matter.  Even if I cast my original IQueryable&amp;lt;Entity&amp;gt; to IQueryable&amp;lt;IEntity&amp;gt;, my query still maintains a DocumentType of Entity.  This is the only type that should matter from a serialization perspective.  If I use an IEntity in an expression, it doesn&apos;t matter how it is serialized.  What matters is how the expression maps to Entity.  &lt;/p&gt;

&lt;p&gt;It doesn&apos;t sound like this is something that is going to get fixed, but it is a real shortcoming of the linq implementation (IMHO).  I can&apos;t expose IQueryable&amp;lt;T&amp;gt; in any of my interfaces without a caveat that the only operations allowed on them things like ToList(), Count(), etc.   &lt;/p&gt;

</comment>
                            <comment id="295492" author="rstam" created="Fri, 22 Mar 2013 02:40:38 +0000"  >&lt;p&gt;Since the same interface can be implemented by many classes, and since we configure serialization at the class level, it is entirely possible that the properties of an interface will be serialized differently in the various classes that implement the interface, so we really can&apos;t determine anything about how the properties are serialized from the interface alone.&lt;/p&gt;</comment>
                            <comment id="295429" author="joe.enzminger" created="Fri, 22 Mar 2013 00:44:38 +0000"  >&lt;p&gt;Looking at it some more, it looks like you are using the serializationInfoHelper not for serialization, but instead to derive ElementNames for queries.  While I know you can&apos;t deserialize an interface, it can be inspected like any other type.  The fix might be to add an additional SerializationProvider that knows how to inspect interfaces (and provide the metadata needed for LINQ, but that throws an exception if you actually try to use the provided serializer for serialization.&lt;/p&gt;
</comment>
                            <comment id="295425" author="joe.enzminger" created="Fri, 22 Mar 2013 00:35:59 +0000"  >&lt;p&gt;Robert,&lt;/p&gt;

&lt;p&gt;My grasp of the internals of LINQ isn&apos;t the greatest, but I don&apos;t think the cast issue was the problem.  In the MongoQueryTranslator.Translate() method, you properly select a documentType of Entity (not IEntity).  But instead of using this DocumentType for deserialization, you use the type of the variableExpression (which in my test, is just an IEntity e) in the where clause.  &lt;/p&gt;

&lt;p&gt;I would think that you would always be deserializing to the DocumentType, and then casting or projecting to the type in the where clause.&lt;/p&gt;

&lt;p&gt;I&apos;m a version or two old, but the exception is thrown in PredicateTranslator.cs line 347.&lt;/p&gt;</comment>
                            <comment id="295413" author="dhireshan" created="Fri, 22 Mar 2013 00:16:44 +0000"  >&lt;p&gt;Hi Robert. I am not following. I tried this example in .Net 4. I also upgraded the CS driver an BSon Component to .Net 4.0. It seems to be failing in &lt;br/&gt;
the LookupSerializer method in BsonSerializer.&lt;/p&gt;

&lt;p&gt;It looks like if an a user defined Interface is passed to this method, it will not return a serializer.&lt;/p&gt;

&lt;p&gt;It does not seem to be a casting issue between IQueryable&amp;lt;Entity&amp;gt; and IQuerable&amp;lt;IEntity&amp;gt;&lt;/p&gt;

&lt;p&gt;Any thoughts?&lt;/p&gt;</comment>
                            <comment id="295404" author="rstam" created="Fri, 22 Mar 2013 00:00:25 +0000"  >&lt;p&gt;The test code appears to require .NET Framework 4.0.&lt;/p&gt;

&lt;p&gt;Otherwise it results in a compiler error that IQueryable&amp;lt;Entity&amp;gt; can&apos;t be implicitly converted to IQueryable&amp;lt;IEntity&amp;gt;. This implicit conversion is not valid in .NET 3.5 but is valid in .NET 4 (due to covariance).&lt;/p&gt;

&lt;p&gt;This implicit conversion is most likely that part that is not supported.&lt;/p&gt;</comment>
                            <comment id="295391" author="dhireshan" created="Thu, 21 Mar 2013 23:33:18 +0000"  >&lt;p&gt;I can confirm that this is indeed an issue. I am experiencing the same issue described in Joe Enzminger&apos;s initial post. This seems to occur for almost all other linq calls. e.g. Take(xx) .OrderByDescending() etc.&lt;/p&gt;

&lt;p&gt;If the query in the Attached MongoTests.cs were to change to &lt;br/&gt;
var entity = finalQuery.ToList().FirstOrDefault(); &lt;br/&gt;
then it works fine but unfortunately, that loads the entire collection first vs running the query on the db.&lt;/p&gt;

&lt;p&gt;Hope this helps.&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10011">
                    <name>Depends</name>
                                            <outwardlinks description="depends on">
                                        <issuelink>
            <issuekey id="52910">CSHARP-601</issuekey>
        </issuelink>
                            </outwardlinks>
                                                        </issuelinktype>
                    </issuelinks>
                <attachments>
                            <attachment id="22793" name="MongoTests.cs" size="1861" author="joe.enzminger" created="Fri, 21 Dec 2012 23:07:06 +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_10857" key="com.pyxis.greenhopper.jira:gh-epic-link">
                        <customfieldname>Epic Link</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>CSHARP-935</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hs7utj:</customfieldvalue>

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