diff --git a/Yubico.Core/src/Yubico/PlatformInterop/Libraries.Net47.cs b/Yubico.Core/src/Yubico/PlatformInterop/Libraries.Net47.cs index 23eccf96..49032337 100644 --- a/Yubico.Core/src/Yubico/PlatformInterop/Libraries.Net47.cs +++ b/Yubico.Core/src/Yubico/PlatformInterop/Libraries.Net47.cs @@ -51,7 +51,7 @@ internal static partial class Libraries /// The implementation details are handled in Libraries.Net47.cs. /// public static void EnsureInitialized() => Net47Implementation.Initialize(); - + /// /// Encapsulates the .NET Framework 4.7 specific implementation details for native library management. /// This nested class handles the dynamic loading of architecture-specific (x86/x64) native libraries. @@ -73,15 +73,16 @@ private static class Net47Implementation private static string NativeShimsPath => Path.Combine( AppDomain.CurrentDomain.BaseDirectory, - RuntimeInformation.OSArchitecture switch + (RuntimeInformation.OSArchitecture, Environment.Is64BitProcess) switch { - Architecture.X86 => "x86", - Architecture.X64 => "x64", - Architecture.Arm64 => "arm64", - var unsupportedArch => throw new ArgumentOutOfRangeException($"Architecture {unsupportedArch } is not supported!") + (Architecture.X86, _) or (Architecture.X64, false) => "x86", + (Architecture.X64, true) => "x64", + (Architecture.Arm64, _) => "arm64", + var unsupportedArch => throw new ArgumentOutOfRangeException( + $"Architecture {unsupportedArch} is not supported!") }, NativeShims); - + /// /// Initializes the native library for the current architecture. /// @@ -99,7 +100,7 @@ internal static void Initialize() { throw new DllNotFoundException( $"Failed to load native library from {NativeShimsPath}. " + - $"Ensure the correct {(Environment.Is64BitProcess ? "x64" : "x86")} version is present.", + $"Ensure the correct {(Environment.Is64BitProcess ? "x64" : "x86")} version is present.", ex); } }