<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Wed Feb 07 21:48:13 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-4436] .NET/C# driver fails to create new mongo client in xamarin</title>
                <link>https://jira.mongodb.org/browse/CSHARP-4436</link>
                <project id="10041" key="CSHARP">C# Driver</project>
                    <description>&lt;h4&gt;&lt;a name=&quot;Summary&quot;&gt;&lt;/a&gt;Summary&lt;/h4&gt;

&lt;p&gt;Error is thrown whenever I try to instantiate a MongoClient or a MongoClientSettings object (from MongoDB.Driver) when passing the connection string to their constructor, when running in Xamarin.&#160;&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;{System.TypeInitializationException: The type initializer for &#8216;MongoDB.Driver.Core.Misc.DnsClientWrapper&#8217; threw an exception. &#8212;&amp;gt; System.AggregateException: Error resolving name servers (Object reference not set to an instance of an object.) (Could not find file &#8220;/etc/resolv.conf&#8221;) &#8212;&amp;gt; System.NullReferenceException: Object reference not set to an instance of an object. at DnsClient.NameServer.QueryNetworkInterfaces () &lt;span class=&quot;error&quot;&gt;&amp;#91;0x0004c&amp;#93;&lt;/span&gt; in &amp;lt;519bb9af32234e5dba6bd0b076a88151&amp;gt;:0 at DnsClient.NameServer.ResolveNameServers (System.Boolean skipIPv6SiteLocal, System.Boolean fallbackToGooglePublicDns) &lt;span class=&quot;error&quot;&gt;&amp;#91;0x0005e&amp;#93;&lt;/span&gt; in &amp;lt;519bb9af32234e5dba6bd0b076a88151&amp;gt;:0 &#8212; End of inner exception stack trace &#8212; at DnsClient.NameServer.ResolveNameServers (System.Boolean skipIPv6SiteLocal, System.Boolean fallbackToGooglePublicDns) &lt;span class=&quot;error&quot;&gt;&amp;#91;0x00192&amp;#93;&lt;/span&gt; in &amp;lt;519bb9af32234e5dba6bd0b076a88151&amp;gt;:0 at DnsClient.LookupClient&#8230;ctor (DnsClient.LookupClientOptions options, DnsClient.DnsMessageHandler udpHandler, DnsClient.DnsMessageHandler tcpHandler) &lt;span class=&quot;error&quot;&gt;&amp;#91;0x000bc&amp;#93;&lt;/span&gt; in &amp;lt;519bb9af32234e5dba6bd0b076a88151&amp;gt;:0 at DnsClient.LookupClient&#8230;ctor (DnsClient.LookupClientOptions options) &lt;span class=&quot;error&quot;&gt;&amp;#91;0x00000&amp;#93;&lt;/span&gt; in &amp;lt;519bb9af32234e5dba6bd0b076a88151&amp;gt;:0 at DnsClient.LookupClient&#8230;ctor () &lt;span class=&quot;error&quot;&gt;&amp;#91;0x00006&amp;#93;&lt;/span&gt; in &amp;lt;519bb9af32234e5dba6bd0b076a88151&amp;gt;:0 at MongoDB.Driver.Core.Misc.DnsClientWrapper&#8230;ctor () &lt;span class=&quot;error&quot;&gt;&amp;#91;0x00006&amp;#93;&lt;/span&gt; in :0 at MongoDB.Driver.Core.Misc.DnsClientWrapper&#8230;cctor () &lt;span class=&quot;error&quot;&gt;&amp;#91;0x00000&amp;#93;&lt;/span&gt; in :0 &#8212; End of inner exception stack trace &#8212; at MongoDB.Driver.Core.Configuration.ConnectionString&#8230;ctor (System.String connectionString) &lt;span class=&quot;error&quot;&gt;&amp;#91;0x00000&amp;#93;&lt;/span&gt; in :0 at MongoDB.Driver.MongoUrlBuilder.Parse (System.String url) &lt;span class=&quot;error&quot;&gt;&amp;#91;0x00000&amp;#93;&lt;/span&gt; in &amp;lt;27273b0202ea4c34867b683ed7b21818&amp;gt;:0 at MongoDB.Driver.MongoUrlBuilder&#8230;ctor (System.String url) &lt;span class=&quot;error&quot;&gt;&amp;#91;0x00006&amp;#93;&lt;/span&gt; in &amp;lt;27273b0202ea4c34867b683ed7b21818&amp;gt;:0 at MongoDB.Driver.MongoUrl&#8230;ctor (System.String url) &lt;span class=&quot;error&quot;&gt;&amp;#91;0x00000&amp;#93;&lt;/span&gt; in &amp;lt;27273b0202ea4c34867b683ed7b21818&amp;gt;:0 at MongoDB.Driver.MongoClientSettings.FromConnectionString (System.String connectionString) &lt;span class=&quot;error&quot;&gt;&amp;#91;0x00000&amp;#93;&lt;/span&gt; in &amp;lt;27273b0202ea4c34867b683ed7b21818&amp;gt;:0 at --REDACTED FILENAME&#8211;&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;&#160;&lt;/p&gt;

&lt;p&gt;This issue is only happening when I run this code in a Xamarin project. I have the exact same code in a .NET 6 project and everything works fine there. The Xamarin project on the other hand targets .NET Standard 2.0 (also tried 2.1 with same issue) and I&#8217;ve been debugging it in an Android 12 device. The driver versions I&#8217;ve tested are 2.4.4 and 2.18.0. IDE is Visual Studio Version 17.2.0&lt;/p&gt;
&lt;h4&gt;&lt;a name=&quot;Pleaseprovidetheversionofthedriver.Ifapplicable%2CpleaseprovidetheMongoDBserverversionandtopology%28standalone%2Creplicaset%2Corshardedcluster%29.&quot;&gt;&lt;/a&gt;Please provide the version of the driver. If applicable, please provide the MongoDB server version and topology (standalone, replica set, or sharded cluster).&lt;/h4&gt;
&lt;h4&gt;&lt;a name=&quot;HowtoReproduce&quot;&gt;&lt;/a&gt;How to Reproduce&lt;/h4&gt;

&lt;p&gt;The lines of code that cause this error are:&lt;/p&gt;

&lt;p&gt;{{}}&lt;/p&gt;
&lt;p/&gt;
&lt;div id=&quot;syntaxplugin&quot; class=&quot;syntaxplugin&quot; style=&quot;border: 1px dashed #bbb; border-radius: 5px !important; overflow: auto; max-height: 30em;&quot;&gt;
&lt;table cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; border=&quot;0&quot; width=&quot;100%&quot; style=&quot;font-size: 1em; line-height: 1.4em !important; font-weight: normal; font-style: normal; color: black;&quot;&gt;
		&lt;tbody &gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;  margin-top: 10px;   margin-bottom: 10px;  width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
			&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p/&gt;
&lt;p&gt;{{string connString = &quot;mongodb+srv://&quot; + user + &quot;:&quot; + secret + &quot;@&quot; + server &lt;ins&gt;&quot;/&quot;&lt;/ins&gt; project +&quot;?retryWrites=true&amp;amp;w=majority&quot;; }}&lt;br/&gt;
{{var settings = MongoClientSettings.FromConnectionString(connString); }}&lt;br/&gt;
{{settings.ServerApi = new ServerApi(ServerApiVersion.V1); }}&lt;br/&gt;
&lt;tt&gt;var mongoClient = new MongoClient(settings);&lt;/tt&gt;&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;

&lt;p&gt;It will break at&#160;&lt;b&gt;MongoClientSettings.FromConnectionString(connString);&lt;/b&gt;&lt;br/&gt;
Or this will also break:&lt;/p&gt;

&lt;p&gt;{{}}&lt;/p&gt;
&lt;p/&gt;
&lt;div id=&quot;syntaxplugin&quot; class=&quot;syntaxplugin&quot; style=&quot;border: 1px dashed #bbb; border-radius: 5px !important; overflow: auto; max-height: 30em;&quot;&gt;
&lt;table cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; border=&quot;0&quot; width=&quot;100%&quot; style=&quot;font-size: 1em; line-height: 1.4em !important; font-weight: normal; font-style: normal; color: black;&quot;&gt;
		&lt;tbody &gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;  margin-top: 10px;   margin-bottom: 10px;  width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
			&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p/&gt;
&lt;p&gt;{{string connString = &quot;mongodb+srv://&quot; + user + &quot;:&quot; + secret + &quot;@&quot; + server + &quot;/&quot;+ project +&quot;?retryWrites=true&amp;amp;w=majority&quot;; }}&lt;br/&gt;
&lt;tt&gt;var mongoClient = new MongoClient(connString);&lt;/tt&gt;&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;
&lt;h4&gt;&lt;a name=&quot;AdditionalBackground&quot;&gt;&lt;/a&gt;Additional Background&lt;/h4&gt;

&lt;p&gt;This issue is only happening when I run this code in a Xamarin project. I have the exact same code in a .NET 6 project and everything works fine there. The Xamarin project on the other hand targets .NET Standard 2.0 (also tried 2.1 with same issue) and I&#8217;ve been debugging it in an Android 12 device. The driver versions I&#8217;ve tested are 2.4.4 and 2.18.0. IDE is Visual Studio Version 17.2.0&lt;/p&gt;</description>
                <environment></environment>
        <key id="2199821">CSHARP-4436</key>
            <summary>.NET/C# driver fails to create new mongo client in xamarin</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="13201">Fixed</resolution>
                                        <assignee username="dmitry.lukyanov@mongodb.com">Dmitry Lukyanov</assignee>
                                    <reporter username="santiagosuarez88@gmail.com">Santiago Suarez</reporter>
                        <labels>
                    </labels>
                <created>Thu, 1 Dec 2022 17:44:04 +0000</created>
                <updated>Sat, 28 Oct 2023 11:47:00 +0000</updated>
                            <resolved>Thu, 2 Mar 2023 13:45:13 +0000</resolved>
                                                    <fixVersion>2.19.1</fixVersion>
                                                        <votes>0</votes>
                                    <watches>5</watches>
                                                                                                                <comments>
                            <comment id="5299669" author="xgen-internal-githook" created="Fri, 24 Mar 2023 19:00:09 +0000"  >&lt;p&gt;Author: &lt;/p&gt;
{&apos;name&apos;: &apos;Dmitry Lukyanov&apos;, &apos;email&apos;: &apos;dmitry.lukyanov@mongodb.com&apos;, &apos;username&apos;: &apos;DmitryLukyanov&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/CSHARP-4436&quot; title=&quot;.NET/C# driver fails to create new mongo client in xamarin&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CSHARP-4436&quot;&gt;&lt;del&gt;CSHARP-4436&lt;/del&gt;&lt;/a&gt;: .NET/C# driver fails to create new mongo client in xamarin. (#1036)&lt;br/&gt;
Branch: v2.19.x&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo-csharp-driver/commit/cbc46103c1082dbe7a605631a4974c533c0f01ea&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-csharp-driver/commit/cbc46103c1082dbe7a605631a4974c533c0f01ea&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="5243519" author="dmitry.lukyanov" created="Thu, 2 Mar 2023 13:51:31 +0000"  >&lt;p&gt;The scope of this ticket was limited to making DnsClientWrapper lazy that will allow avoiding this issue for cases where srv resolving is not required. Please follow to &lt;a href=&quot;https://jira.mongodb.org/browse/CSHARP-4556&quot; title=&quot;Consider custom LookupClient configuration for dns resolving&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CSHARP-4556&quot;&gt;CSHARP-4556&lt;/a&gt; for further improvements here&lt;/p&gt;</comment>
                            <comment id="5243493" author="xgen-internal-githook" created="Thu, 2 Mar 2023 13:43:54 +0000"  >&lt;p&gt;Author: &lt;/p&gt;
{&apos;name&apos;: &apos;Dmitry Lukyanov&apos;, &apos;email&apos;: &apos;dmitry.lukyanov@mongodb.com&apos;, &apos;username&apos;: &apos;DmitryLukyanov&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/CSHARP-4436&quot; title=&quot;.NET/C# driver fails to create new mongo client in xamarin&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CSHARP-4436&quot;&gt;&lt;del&gt;CSHARP-4436&lt;/del&gt;&lt;/a&gt;: .NET/C# driver fails to create new mongo client in xamarin. (#1036)&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo-csharp-driver/commit/e896c22321aba02023aa38f84b80524bdeab99c4&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-csharp-driver/commit/e896c22321aba02023aa38f84b80524bdeab99c4&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="5024071" author="james.kovacs" created="Fri, 2 Dec 2022 00:03:49 +0000"  >&lt;p&gt;The .NET/C# Driver uses DnsClient.NET, a third-party DNS library, for resolving SRV and TXT records. Unfortunately it appears that increased security restrictions around DNS introduced in Android Oreo prevent DnsClient.NET from working correctly. See &lt;a href=&quot;https://github.com/MichaCo/DnsClient.NET/issues/17&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;issue #17&lt;/a&gt; in DnsClient.NET&apos;s issue tracker. Given that the issue is closed, it doesn&apos;t appear that a fix is forthcoming.&lt;/p&gt;

&lt;p&gt;You can work around this issue by using the &lt;a href=&quot;https://www.mongodb.com/docs/manual/reference/connection-string/#standard-connection-string-format&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;standard connection string format&lt;/a&gt; (AKA &lt;tt&gt;mongodb://&lt;/tt&gt;) rather than the DNS seedlist format (AKA &lt;tt&gt;mongodb+srv://&lt;/tt&gt;). A and CNAME record lookups use .NET&apos;s built-in capabilities and don&apos;t require any third-party libraries. Unfortunately these built-in capabilities do not include SRV and TXT record lookups, which is why we depend on DnsClient.NET for these record types.&lt;/p&gt;

&lt;p&gt;Closing this ticket as this is a limitation of a third-party library and we are not aware of another third-party library that can work around this issue.&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10620">
                    <name>Issue split</name>
                                            <outwardlinks description="split to">
                                        <issuelink>
            <issuekey id="2279469">CSHARP-4556</issuekey>
        </issuelink>
                            </outwardlinks>
                                                        </issuelinktype>
                    </issuelinks>
                <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                                                                                                                                                                                                                    <customfield id="customfield_13552" key="com.go2group.jira.plugin.crm:crm_generic_field">
                        <customfieldname>Case</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue><![CDATA[[5006R00001r8nIEQAY, 5006R00001rZMfDQAW]]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                    <customfield id="customfield_15850" key="com.atlassian.jira.plugins.jira-development-integration-plugin:devsummary">
                        <customfieldname>Development</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10257" key="com.atlassian.jira.plugin.system.customfieldtypes:radiobuttons">
                        <customfieldname>Documentation Changes</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="11861"><![CDATA[Not Needed]]></customfieldvalue>

                        </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|i13i5c:</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>