[CSHARP-3107] calling fromconnectionString throws null DNSClient exception - Created: 20/May/20  Updated: 21/May/20  Resolved: 21/May/20

Status: Closed
Project: C# Driver
Component/s: Connectivity
Affects Version/s: 2.9.0
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Sasan Pasha Assignee: Dmitry Lukyanov (Inactive)
Resolution: Cannot Reproduce Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

visual stuido 2019, csharp, xamarin forms - azure cosmos DB



 Description   

it seems something has changed since version 2.9.0 that throws the exception whenever you try to initiate the DB from the connection string. previous version all works fine.

 

at DnsClient.NameServer.ResolveNameServers (System.Boolean skipIPv6SiteLocal, System.Boolean fallbackToGooglePublicDns) [0x0005e] in <93b57b4b99c64a96a2c065ea9ae1fc1f>:0
at DnsClient.LookupClient..ctor () [0x00000] in <93b57b4b99c64a96a2c065ea9ae1fc1f>:0
at MongoDB.Driver.Core.Misc.DnsClientWrapper..ctor () [0x00006] in <69a19ce1f0ff410ca77cc0cfdf31b04c>:0
at MongoDB.Driver.Core.Clusters.DnsMonitorFactory..ctor (MongoDB.Driver.Core.Events.IEventSubscriber eventSubscriber, MongoDB.Driver.Core.Misc.IDnsResolver dnsResolver) [0x00017] in <69a19ce1f0ff410ca77cc0cfdf31b04c>:0
at MongoDB.Driver.Core.Clusters.MultiServerCluster..ctor (MongoDB.Driver.Core.Configuration.ClusterSettings settings, MongoDB.Driver.Core.Servers.IClusterableServerFactory serverFactory, MongoDB.Driver.Core.Events.IEventSubscriber eventSubscriber, MongoDB.Driver.Core.Clusters.IDnsMonitorFactory dnsMonitorFactory) [0x0005d] in <69a19ce1f0ff410ca77cc0cfdf31b04c>:0
at MongoDB.Driver.Core.Clusters.ClusterFactory.CreateMultiServerCluster (MongoDB.Driver.Core.Configuration.ClusterSettings settings) [0x00000] in <69a19ce1f0ff410ca77cc0cfdf31b04c>:0
at MongoDB.Driver.Core.Clusters.ClusterFactory.CreateCluster () [0x000bf] in <69a19ce1f0ff410ca77cc0cfdf31b04c>:0
at MongoDB.Driver.Core.Configuration.ClusterBuilder.BuildCluster () [0x00006] in <69a19ce1f0ff410ca77cc0cfdf31b04c>:0
at MongoDB.Driver.ClusterRegistry.CreateCluster (MongoDB.Driver.ClusterKey clusterKey) [0x000be] in <3b162f88ef324ea39a81e2d6bf362821>:0
at MongoDB.Driver.ClusterRegistry.GetOrCreateCluster (MongoDB.Driver.ClusterKey clusterKey) [0x00021] in <3b162f88ef324ea39a81e2d6bf362821>:0
at MongoDB.Driver.MongoClient..ctor (MongoDB.Driver.MongoClientSettings settings) [0x0002d] in <3b162f88ef324ea39a81e2d6bf362821>:0
at SensoDrive.Client.Infrastructure.Database.CosmoMongoDb.InitializeCosmoDBAsync () [0x0002f]



 Comments   
Comment by Sasan Pasha [ 21/May/20 ]

can you please confirm you used Visual studio 2019, Xamarin Forms cross platform ( android) and trying to call the library? the issue shows up on the android device not being able to read the DNS - older version works fine. 

the fact that older versions of the library work and this version doesn't points to the fact that something in this library is changed and there is nothing to do with azure - can you please check before closing the ticket?

Comment by Dmitry Lukyanov (Inactive) [ 21/May/20 ]

Hello sasan.pasha@gmail.com,
Thanks for your report. I've tried to reproduce this issue with the mongodb atlas server, but with no luck. So it looks like this error is cosmosdb specific. If so, it's better to ask it here: https://gotcosmos.com/community. If you have more details, please add them and we will be happy to investigate them.

Comment by Sasan Pasha [ 21/May/20 ]

the connection string is "mongodb://[username]:[password]@[AppName].mongo.cosmos.azure.com:10255/?ssl=true&replicaSet=globaldb&maxIdleTimeMS=120000&appName=@[AppName]@"

the full exception is 

Could not find file "/etc/resolv.conf"

DnsClient {System.NullReferenceException: Object reference not set to an instance of an object.
at DnsClient.NameServer.QueryNetworkInterfaces () [0x00047] in <62d2e9033ef84b01abb5bb4b3b2561e7>:0
at DnsClient.NameServer.ResolveNameServers (System.Boolean skipIPv6SiteLocal, System.Boolean fallbackToGooglePublicDns) [0x0005e] in <62d2e9033ef84b01abb5bb4b3b2561e7>:0 }

at DnsClient.NameServer.ResolveNameServers (System.Boolean skipIPv6SiteLocal, System.Boolean fallbackToGooglePublicDns) [0x000df] in <62d2e9033ef84b01abb5bb4b3b2561e7>:0
at DnsClient.LookupClient..ctor (DnsClient.LookupClientOptions options, DnsClient.DnsMessageHandler udpHandler, DnsClient.DnsMessageHandler tcpHandler) [0x000bd] in <62d2e9033ef84b01abb5bb4b3b2561e7>:0
at DnsClient.LookupClient..ctor (DnsClient.LookupClientOptions options) [0x00000] in <62d2e9033ef84b01abb5bb4b3b2561e7>:0
at DnsClient.LookupClient..ctor () [0x00006] in <62d2e9033ef84b01abb5bb4b3b2561e7>:0
at MongoDB.Driver.Core.Misc.DnsClientWrapper..ctor () [0x00006] in <7564e277fa414dd0a424d279e88f55b9>:0
at MongoDB.Driver.Core.Clusters.DnsMonitorFactory..ctor (MongoDB.Driver.Core.Events.IEventSubscriber eventSubscriber, MongoDB.Driver.Core.Misc.IDnsResolver dnsResolver) [0x00017] in <7564e277fa414dd0a424d279e88f55b9>:0
at MongoDB.Driver.Core.Clusters.MultiServerCluster..ctor (MongoDB.Driver.Core.Configuration.ClusterSettings settings, MongoDB.Driver.Core.Servers.IClusterableServerFactory serverFactory, MongoDB.Driver.Core.Events.IEventSubscriber eventSubscriber, MongoDB.Driver.Core.Clusters.IDnsMonitorFactory dnsMonitorFactory) [0x0005d] in <7564e277fa414dd0a424d279e88f55b9>:0
at MongoDB.Driver.Core.Clusters.ClusterFactory.CreateMultiServerCluster (MongoDB.Driver.Core.Configuration.ClusterSettings settings) [0x00000] in <7564e277fa414dd0a424d279e88f55b9>:0
at MongoDB.Driver.Core.Clusters.ClusterFactory.CreateCluster () [0x000d3] in <7564e277fa414dd0a424d279e88f55b9>:0
at MongoDB.Driver.Core.Configuration.ClusterBuilder.BuildCluster () [0x00006] in <7564e277fa414dd0a424d279e88f55b9>:0
at MongoDB.Driver.ClusterRegistry.CreateCluster (MongoDB.Driver.ClusterKey clusterKey) [0x000be] in <951c7635de1243b1bc8bc6a47a9933d5>:0
at MongoDB.Driver.ClusterRegistry.GetOrCreateCluster (MongoDB.Driver.ClusterKey clusterKey) [0x00021] in <951c7635de1243b1bc8bc6a47a9933d5>:0
at MongoDB.Driver.MongoClient..ctor (MongoDB.Driver.MongoClientSettings settings) [0x0002d] in <951c7635de1243b1bc8bc6a47a9933d5>:0

Comment by Dmitry Lukyanov (Inactive) [ 20/May/20 ]

Hello sasan.pasha@gmail.com,
can you please provide your connection string (for security reasons you can replace real credentials and server address with placeholder values). Also, it will be great if you provide the whole error message.

Generated at Wed Feb 07 21:44:23 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.