microsoft / WindowsAppSDK

The Windows App SDK empowers all Windows desktop apps with modern Windows UI, APIs, and platform features, including back-compat support, shipped via NuGet.
https://docs.microsoft.com/windows/apps/windows-app-sdk/
MIT License
3.79k stars 320 forks source link

Unable to create Virtual smartcard #4497

Open azahur opened 3 months ago

azahur commented 3 months ago

Describe the bug

I have a basic test app using VS Studio Blank app for winUi 3 where I try to call the following code When I try to run the following code which works in UWP

SmartCardPinPolicy pinPolicy = new SmartCardPinPolicy(); pinPolicy.MinLength = 6;

IBuffer adminkey = CryptographicBuffer.GenerateRandom(24);

SmartCardProvisioning provisioning = await SmartCardProvisioning.RequestVirtualSmartCardCreationAsync( "Card friendly name", adminkey, pinPolicy); I get the runtime error Exception thrown: 'System.Runtime.InteropServices.COMException' in WinRT.Runtime.dll

Are some components of Windows.Devices.SmartCards; not supported. ? Will they ever be supported or should we move to PInvokes Trying to migrate a UWP app

Steps to reproduce the bug

create a blank project Open Visual Studio, and on the start window, choose Create a new project.

On the Create a new project screen, enter WinUI in the search box, choose the C# template for Blank App, Packaged (WinUI 3 in Desktop), and then choose Next.

add the following code to some button click SmartCardPinPolicy pinPolicy = new SmartCardPinPolicy(); pinPolicy.MinLength = 6;

IBuffer adminkey = CryptographicBuffer.GenerateRandom(24);

SmartCardProvisioning provisioning = await SmartCardProvisioning.RequestVirtualSmartCardCreationAsync( "Card friendly name", adminkey, pinPolicy);

Expected behavior

A set PIN Prompt dialog should be presented and virtual smartcard instance should be created

Screenshots

No response

NuGet package version

None

Packaging type

Unpackaged

Windows version

No response

IDE

Visual Studio 2022

Additional context

No response

azahur commented 1 month ago

Do we know if this UWP Gap will ever be addressed?