MichaCo / DnsClient.NET

DnsClient.NET is a simple yet very powerful and high performant open source library for the .NET Framework to do DNS lookups
https://dnsclient.michaco.net
Apache License 2.0
781 stars 137 forks source link

new LookupClient() fails on .NET Core 3.1 in Azure functions (V3) #162

Closed BorisDog closed 2 years ago

BorisDog commented 2 years ago

Steps to reproduce:

  1. Create Azure Functions .net core 3.1 project (windows)
  2. Reference DNS Client 1.6.0
  3. Add var lookupClient = new LookupClient();
  4. Trigger the function locally (no need for Azure instance)

This will result in:

  1. Failure to load Microsoft.Win32.Registry, Version=5.0.0.0 (resolved with adding <_FunctionsSkipCleanOutput>true</_FunctionsSkipCleanOutput> in project settings.
  2. {"Registry is not supported on this platform."} in Registry.LocalMachine.OpenSubKey

Registry.LocalMachine.OpenSubKey does work in .net core 3.1 console project.

Note: We are seeing this error when trying to use MongoDB .NET driver in Azure functions 3.1: CSHARP-4200 This issue was resolved in Azure Function v3 (.net 6)., but this is still a blocker for existing apps to upgrade to the latest new MongoDB .NET driver.

MichaCo commented 2 years ago

I can push a release which I think should fix those errors, see #163 I tested it locally with an azure function project, I did get an error before the change and everything works fine after.

Could you verify that somehow, too, before I push that to nuget.org? @BorisDog It is on myget https://www.myget.org/feed/dnsclient/package/nuget/DnsClient

Thanks, Michael

BorisDog commented 2 years ago

Thank you @MichaCo! I will verify and update here.

BorisDog commented 2 years ago

The new version verified to work in Azure Functions v3. Thank you @MichaCo!

MichaCo commented 2 years ago

@BorisDog thanks for testing! The fix has been released

/closing