<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Wed Feb 07 21:39:01 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-1230] NullReferenceException on Find() operation.</title>
                <link>https://jira.mongodb.org/browse/CSHARP-1230</link>
                <project id="10041" key="CSHARP">C# Driver</project>
                    <description>&lt;p&gt;I installed mongocsharpdriver v2.0, but on one operation in my project: &lt;br/&gt;
...&lt;br/&gt;
var query1 = Query.EQ();&lt;br/&gt;
var query2 = Query.EQ();&lt;br/&gt;
var query3 = Query.In();&lt;br/&gt;
var query4 = Query.EQ();&lt;br/&gt;
var query5 = Query.EQ();&lt;br/&gt;
var query6 = Query.Or(query4, query5);&lt;br/&gt;
var queryAll = Query.And(query1, query2, query3, query6);&lt;br/&gt;
var result = Collection.FindOne(queryAll);&lt;br/&gt;
...&lt;/p&gt;

&lt;p&gt;i catched exception: &lt;br/&gt;
An exception of type &apos;System.NullReferenceException&apos; occurred in MongoDB.Bson.dll but was not handled in user code&lt;br/&gt;
Additional information: Object reference not set to an instance of an object.&lt;/p&gt;

&lt;p&gt;But, if i changed this operation like this: &lt;br/&gt;
var result = Collection.Count(queryAll); - worked well. &lt;/p&gt;

&lt;p&gt;Also, this operation working properly on driver version 1.8 and version 1.10. &lt;br/&gt;
What could it be?&lt;/p&gt;</description>
                <environment>Windows 7, MS Visual Studio 2013, MongoServer v2.4.6, MongoDriver v2.0</environment>
        <key id="193884">CSHARP-1230</key>
            <summary>NullReferenceException on Find() operation.</summary>
                <type id="3" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14718&amp;avatarType=issuetype">Task</type>
                                            <priority id="1" iconUrl="https://jira.mongodb.org/images/icons/priorities/blocker.svg">Blocker - P1</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="mtred">mtred</reporter>
                        <labels>
                            <label>driver</label>
                            <label>query</label>
                            <label>question</label>
                    </labels>
                <created>Fri, 3 Apr 2015 14:01:59 +0000</created>
                <updated>Fri, 5 Apr 2019 13:59:25 +0000</updated>
                            <resolved>Wed, 27 Jan 2016 15:22:00 +0000</resolved>
                                    <version>2.0</version>
                                                    <component>BSON</component>
                                        <votes>0</votes>
                                    <watches>1</watches>
                                                                                                                <comments>
                            <comment id="876637" author="mtred" created="Thu, 9 Apr 2015 03:38:17 +0000"  >&lt;p&gt;UPDATE: Added example console code with errors. (MongoServer 2.4.6, MongoDriver 2.0)&lt;/p&gt;

&lt;p&gt;After removing attribute &lt;span class=&quot;error&quot;&gt;&amp;#91;BsonSerializer&amp;#93;&lt;/span&gt; in the class definition - all working good.&lt;br/&gt;
I catch exceptions in my project was only due to attributes like &lt;span class=&quot;error&quot;&gt;&amp;#91;BsonSerializer&amp;#93;&lt;/span&gt;.&lt;/p&gt;

&lt;p&gt;Thanks for all&lt;/p&gt;</comment>
                            <comment id="875657" author="mtred" created="Wed, 8 Apr 2015 13:48:33 +0000"  >&lt;p&gt;My project old. There installed driver version 1.8 and everything works fine. After the transfer to version 2.0 i have many errors - BsonSerializer, Collection.Aggregate, and this error - NullException on Find() operation. I changed methods with  BsonSerializer, Collection.Aggregate - i think, worked well, but not understand why catched exception on Find() operation.&lt;br/&gt;
I tried to recreate a situation similar to this in simple console application, but in this case everything goes fine, no errors.&lt;br/&gt;
Earler, i commented (were good), but am i wrong and deleted this comment.&lt;br/&gt;
I thought that the problem in connecting to the database. This is partly true. I fixed the connection settings. But the error remained. Now realized that the problem in the request, namely in the class definition. Trying to find the error.&lt;/p&gt;</comment>
                            <comment id="875550" author="craiggwilson" created="Wed, 8 Apr 2015 11:36:50 +0000"  >&lt;p&gt;Hi mtred,&lt;/p&gt;

&lt;p&gt;Thanks for the follow-up. I saw a comment that said you were good (and then was deleted), so I wasn&apos;t sure what was going on.&lt;/p&gt;

&lt;p&gt;I&apos;m still not completely clear on what is being done to cause this problem. If you could create a simple little console program that causes this exception, it would be immensely helpful in getting it fixed.&lt;/p&gt;

&lt;p&gt;Thanks,&lt;br/&gt;
Craig&lt;/p&gt;</comment>
                            <comment id="875514" author="mtred" created="Wed, 8 Apr 2015 09:06:03 +0000"  >&lt;p&gt;Hi Craig,&lt;/p&gt;

&lt;p&gt;I think, I found problem on this issue, but i don&apos;t know how to solve it. The fact that the data are subjected to search in Query are not like IENumerable, but ENUM.&lt;br/&gt;
If i change my query (Query.EQ(&quot;status&quot;, &quot;active&quot;) for this: Query&amp;lt;UserStatus&amp;gt;.EQ(x=&amp;gt;x.status, &quot;active&quot;), then i catched exception:&lt;/p&gt;

&lt;p&gt;&quot;Cannot convert lambda expression to delegate type &apos;System.Func&amp;lt;Transfer.Common.Status,System.Collections.Generic.IEnumerable&amp;lt;string&amp;gt;&amp;gt;&apos; because some of the return types in the block are not implicitly convertible to the delegate return type ...\Common\StatusAccessor.cs&quot;&lt;/p&gt;</comment>
                            <comment id="873268" author="craiggwilson" created="Mon, 6 Apr 2015 12:05:09 +0000"  >&lt;p&gt;Hi mtred,&lt;/p&gt;

&lt;p&gt;Thanks for the report. Given the stack trace, we are going to need a lot more information to reproduce this. Can you provide a breaking test or some code in a console program that causes the issue? Particularly, since this happens when automapping a class, we need to see your class definition(s).&lt;/p&gt;

&lt;p&gt;Thanks,&lt;br/&gt;
Craig&lt;/p&gt;</comment>
                    </comments>
                    <attachments>
                            <attachment id="70153" name="Example Code.rar" size="13143404" author="mtred" created="Thu, 9 Apr 2015 03:38:17 +0000"/>
                            <attachment id="69618" name="stacktrace.txt" size="1865" author="mtred" created="Fri, 3 Apr 2015 14:01:59 +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_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hs7rrb:</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>