<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Wed Feb 07 21:49: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-4811] Linux /.Net 7 / mongodb.driver.core.2.21.0 - ExpressionNotSupportedException</title>
                <link>https://jira.mongodb.org/browse/CSHARP-4811</link>
                <project id="10041" key="CSHARP">C# Driver</project>
                    <description>&lt;h4&gt;&lt;a name=&quot;MongodbStandaloneserver&quot;&gt;&lt;/a&gt;&lt;b&gt;Mongodb Standalone server&lt;/b&gt;&lt;/h4&gt;
&lt;h4&gt;&lt;a name=&quot;Summary&quot;&gt;&lt;/a&gt;Summary&lt;/h4&gt;

&lt;p&gt;Hello everyone,&lt;/p&gt;

&lt;p&gt;I encountered an error when executing the query illustrated below.&lt;/p&gt;

&lt;p&gt;&lt;tt&gt;varcollection = _mongoDb.GetCollection&amp;lt;MyCollection&amp;gt;();&lt;/tt&gt;&lt;br/&gt;
&lt;tt&gt;var data = collection.AsQueryable().Any(x=&amp;gt;x.Identifier==newGuid(&quot;72E32DEE-6D98-427E-8863-263414DACC8D&quot;));&lt;/tt&gt;&lt;br/&gt;
The error is:&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;Exception has occurred: CLR/MongoDB.Driver.Linq.ExpressionNotSupportedException&lt;br/&gt;
Exception thrown: &apos;MongoDB.Driver.Linq.ExpressionNotSupportedException&apos; in MongoDB.Driver.dll: &apos;Expression not supported: (x.Identifier == 72e32dee-6d98-427e-8863-263414dacc8d).&apos;&lt;br/&gt;
&#160; &#160;at MongoDB.Driver.Linq.Linq3Implementation.Translators.ExpressionToFilterTranslators.MethodTranslators.StringExpressionToRegexFilterTranslator.TranslateComparisonExpression(TranslationContext context, Expression expression, Expression leftExpression, AstComparisonFilterOperator comparisonOperator, Expression rightExpression)&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;&#160;&lt;/p&gt;

&lt;p&gt;From my understanding, it seems to be related to &lt;em&gt;System.Linq.Queryable&lt;/em&gt; while using the MongoDB.Driver version 2.21 in .NET 7.&lt;/p&gt;

&lt;p&gt;Does anyone have insights or solutions regarding this issue?&lt;/p&gt;

&lt;p&gt;Your assistance is greatly appreciated. Thank you!&lt;/p&gt;
&lt;h4&gt;&lt;a name=&quot;HowtoReproduce&quot;&gt;&lt;/a&gt;How to Reproduce&lt;/h4&gt;

&lt;p&gt;varcollection = _mongoDb.GetCollection&amp;lt;MyCollection&amp;gt;();&lt;br/&gt;
var data = collection.AsQueryable().Any(x=&amp;gt;x.Identifier==newGuid(&quot;72E32DEE-6D98-427E-8863-263414DACC8D&quot;));&lt;br/&gt;
&#160;&lt;/p&gt;</description>
                <environment></environment>
        <key id="2474307">CSHARP-4811</key>
            <summary>Linux /.Net 7 / mongodb.driver.core.2.21.0 - ExpressionNotSupportedException</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="13202">Works as Designed</resolution>
                                        <assignee username="boris.dogadov@mongodb.com">Boris Dogadov</assignee>
                                    <reporter username="michele.lauriola@gmail.com">Michele Lauriola</reporter>
                        <labels>
                            <label>Bug</label>
                    </labels>
                <created>Fri, 13 Oct 2023 19:22:45 +0000</created>
                <updated>Fri, 27 Oct 2023 13:24:36 +0000</updated>
                            <resolved>Tue, 17 Oct 2023 16:07:37 +0000</resolved>
                                    <version>2.21.0</version>
                                                    <component>LINQ3</component>
                                        <votes>0</votes>
                                    <watches>4</watches>
                                                                                                                <comments>
                            <comment id="5785288" author="JIRAUSER1257742" created="Tue, 17 Oct 2023 16:07:21 +0000"  >&lt;p&gt;Thanks for confirming &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=michele.lauriola%40gmail.com&quot; class=&quot;user-hover&quot; rel=&quot;michele.lauriola@gmail.com&quot;&gt;michele.lauriola@gmail.com&lt;/a&gt;.&lt;br/&gt;
We are closing this ticket now.&lt;/p&gt;</comment>
                            <comment id="5781802" author="JIRAUSER1275471" created="Mon, 16 Oct 2023 16:30:55 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=robert%40mongodb.com&quot; class=&quot;user-hover&quot; rel=&quot;robert@mongodb.com&quot;&gt;robert@mongodb.com&lt;/a&gt; you&apos;re correct; it&apos;s not a bug.&lt;/p&gt;

&lt;p&gt;I overlooked the &apos;JustMyCode&apos; settings. &lt;/p&gt;

&lt;p&gt;Thank you all for your assistance, and I apologize for mistakenly reporting an issue.&lt;/p&gt;</comment>
                            <comment id="5778605" author="rstam" created="Sat, 14 Oct 2023 14:24:54 +0000"  >&lt;p&gt;This looks like it&apos;s the same issue as &lt;a href=&quot;https://jira.mongodb.org/browse/CSHARP-4803&quot; title=&quot;Refactor StringExpressionToRegexFilterTranslator.TryTranslate to not use an exception for flow control when possible&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CSHARP-4803&quot;&gt;&lt;del&gt;CSHARP-4803&lt;/del&gt;&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The exception you are observing is thrown and caught internally. It&apos;s not a bug because after catching the exception the correct actions are taken. Nonetheless we have refactored the code a bit to avoid throwing exceptions when possible.&lt;/p&gt;

&lt;p&gt;You are probably only seeing the exception because you asked the debugger to stop whenever any exception is thrown.&lt;/p&gt;</comment>
                            <comment id="5778391" author="JIRAUSER1275471" created="Sat, 14 Oct 2023 07:19:50 +0000"  >&lt;p&gt;Thank you, Boris, for your assistance.&lt;/p&gt;

&lt;p&gt;I&apos;ll attempt to create a working example in Visual Studio Code.&lt;/p&gt;

&lt;p&gt;My .NET project is quite extensive, so I&apos;ll need to extract and clean up a significant amount of content.&lt;/p&gt;

&lt;p&gt;I wanted to add one more observation: in my environment, the error surfaces when I set the &apos;&lt;b&gt;JustMyCode&lt;/b&gt;&apos; option to &apos;false&apos;. Interestingly, when it&apos;s set to &apos;true&apos;, no errors are observed.&lt;/p&gt;

&lt;p&gt;In both scenarios, however, the functionality remains intact (i.e., the correct records are retrieved).&lt;/p&gt;

&lt;p&gt;Is it possible that the exception I&apos;m witnessing is a managed one, triggered in a deeper layer but handled by an upper layer in the call stack with some sort of fallback?&lt;/p&gt;

&lt;p&gt;Thank you again for your help&lt;/p&gt;

&lt;p&gt;ps: I&apos;d like to note that I couldn&apos;t reproduce the error using .NET Fiddle. Here&apos;s the link for reference: &lt;a href=&quot;https://dotnetfiddle.net/mXGTVe&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://dotnetfiddle.net/mXGTVe&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="5778071" author="JIRAUSER1257742" created="Fri, 13 Oct 2023 23:20:24 +0000"  >&lt;p&gt;Hi &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=michele.lauriola%40gmail.com&quot; class=&quot;user-hover&quot; rel=&quot;michele.lauriola@gmail.com&quot;&gt;michele.lauriola@gmail.com&lt;/a&gt;&#160;&lt;/p&gt;

&lt;p&gt;I have failed to reproduce this with 2.21 driver and .NET 7 using the sample code (with both LINQ2 and LINQ3).&lt;br/&gt;
Is it possible to provide a .NET project that demonstrates the issue?&lt;/p&gt;

&lt;p&gt;Thanks.&lt;/p&gt;</comment>
                            <comment id="5777647" author="dbeng-pm-bot" created="Fri, 13 Oct 2023 19:22:48 +0000"  >&lt;p&gt;Hi &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=michele.lauriola%40gmail.com&quot; class=&quot;user-hover&quot; rel=&quot;michele.lauriola@gmail.com&quot;&gt;michele.lauriola@gmail.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>
                                            <outwardlinks description="duplicates">
                                        <issuelink>
            <issuekey id="2453143">CSHARP-4803</issuekey>
        </issuelink>
                            </outwardlinks>
                                                        </issuelinktype>
                    </issuelinks>
                <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_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|i2dxsc:</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>