Closed camnewnham closed 2 years ago
This PR implements the second solution, simply wrapping Registry.LocalMachine.OpenSubKey
in a try/catch
for DllNotFoundException
, and resolves the issue in my scenario.
Hi @camnewnham, Thanks for reporting the issue, that's a bit unfortunate how that Windows registry Nuget doesn't handle errors by itself...
I'll have a look into that. Thanks for the PR, too btw. Might take a bit until that gets released though
This is also an issue for Xamarin.iOS targets. It fails linking.
@Cheesebaron & @camnewnham, this should be fixed in 1.6.1 which just released.
Continuation from https://github.com/sipsorcery-org/sipsorcery/issues/688
I've been using DnsClient via https://github.com/sipsorcery-org/sipsorcery and run into an interesting issue. The usage here is in Unity via IL2CPP, targeting Windows Universal ARM64 (HoloLens 2).
Everything functions correctly on the target platform when using the .NET Framework build, but the .NET Standard build throws an exception originating at
NameServer.ResolveNameServer
, ultimatelySystem.DllNotFoundException: Unable to load DLL 'advapi32.dll': The specified module could not be found.
I'm not particularly familiar with the Windows APIs in question, but thoughts would be:
RuntimeInformation.IsOSPlatform(OSPlatform.Windows)
returns true and assumes the functions are available.Registry.LocalMachine.OpenSubKey
subsequently throws aDllNotFoundException
Related issues (unable to access advapi.dll on this Windows flavour):
https://stackoverflow.com/questions/48899692/how-to-access-registry-key-in-a-uwp-app
A possible solution could be to check the proccessor architecture if running on windows to determine if running on ARM/ARM64.
Alternatively just putting the calls that require this library (OpenSubKey) in a try/catch and reverting to a fallback code path could work?
Any thoughts? Happy to do some further investigation/testing.