TargetInvocationException when using uwp bluetooth APIs in .NET 5 winforms app

0

The code works fine on Windows 10,
but I'm getting TargetInvocationException in Windows 8.1 when using uwp bluetooth APIs in my .NET 5 winforms app

enter image description here

inner exception is

Class not registered (0x80040154 (REGDB_E_CLASSNOTREG))

code:

private BluetoothLEAdvertisementWatcher BTWatch = new BluetoothLEAdvertisementWatcher();

in my project I have added reference to "UwpDesktop-Updated" package & windows SDK 10.0.17763.132 is installed on my Windows 8.1 machine.

enter image description here

Let me know how to fix this issue occurring on windows 8.1

c#
.net
winforms
uwp
asked on Stack Overflow May 5, 2021 by Nitin S • edited May 5, 2021 by Nitin S

1 Answer

1

TargetInvocationException when using uwp bluetooth APIs in .NET 5 winforms app

I'm afraid you can't run it in Windows 8.1 system, please refer BluetoothLEAdvertisementWatcher document, the support lowest version is Build 10240, and it will not work in Windows 8.1 system.

answered on Stack Overflow May 6, 2021 by Nico Zhu - MSFT • edited May 6, 2021 by Nico Zhu - MSFT

User contributions licensed under CC BY-SA 3.0