Closed Cinfob09 closed 1 year ago
Is that really a Windows machine this is running on. The code here tries to find DNS config on non windows machines. This shouldn't run if its windows (or that check does not return the right OS -.-)
I'll take a look later but maybe you can give me more details about your environment that code is running in?
Thanks
Hello, I am a beginner and I am on windows 11 and my IDE is Visual Studio do you know what I have to do to make it find the DNS configuration on windows machines. Thanks a lot for your help! Cinfob09
Hey @Cinfob09 , no problem ;) The DNS configuration would come from your network adapter. Usually that just works. There might be problems if you use a private VPN for example, those sometimes block any DNS traffic which isn't controlled by the VPN. Also, it matters where you run your code. Is it just a console app your run from VS? Or is it running in a container or WSL? In that case it might be a different story
That being said, under Windows, that code which causes the error you are getting should not even run. So, it looks like a bug, I'll take a look
Hi, I don't use WSL and it's not a console app it's an app that will run on a mobile device like a tablet or android and iOS phone. I will check my network card.
Getting the DNS server on a mobile device works completely differently and isn't supported by this library. Are you running the mongodb client in your mobile app / via an emulator in Visual Studio?
Yes, but I changed my network card settings and now no error message appears but it can't add my json document to the database. I checked my connection string and it works in mongo db compass and it has the authorization to import the document.
well, good luck with googling for help for that ;) /closing the issue
Hi i have an error System.TypeInitializationException: ‘The type initializer for ‘MongoDB.Driver.Core.Misc.DnsClientWrapper’ threw an exception.’ can you help me with this.
MongoDB .NET/C# Driver version : 2.17.1 .NET version : .net 2.0 Standard Operating system and version : Windows 11 21H2 Full stack trace : System.TypeInitializationException: 'The type initializer for 'MongoDB.Driver.Core.Misc.DnsClientWrapper' threw an exception.' and System.AggregateException: 'Error resolving name servers (Object reference not set to an instance of an object.) (Could not find file "/etc/resolv.conf")'
I talk to an MongoDB employee and he respond me to create an issue here !