Cannot create BluetoothLEDevice (BLE) from WPF application. Only from UWP


  • Hi, with the new creators update, I'm trying to create an interface between a low-energy bluetooth device and a computer game (win10). What I need to do, is to read a file and according it send write values to a GATT characteristic of said device. 

    Well, I got both parts working, but not together. I realize that UWP apps cannot access the filesystem, which is why I have to use .NET (WPF) to find the log file. I've added System.Runtime.WindowsRuntime and Windows (C:\Program Files (x86)\Windows Kits\10\UnionMetadata\Windows.winmd) references to my project, which allowed me to use the new BLE classes. 

    Well that's great, but it doesn't work. I can't get/create a bluetooth device. I CAN find my device using 


    or even 


    but when I call

    await BluetoothLEDevice.FromBluetoothAddressAsync(address);


    await BluetoothLEDevice.FromIdAsync(device.Id);

    The code just hangs/freezes - the function never completes. No error or anything.

    When I try the exact same code in an UWP app, the function works fine and I can connect to the device and read/write values.

    Is using BLE disallowed in anything else than UWP? Because that kinda sucks. Or do I just have to make some special changes to the settings?

    • Edited by webik150 Monday, April 17, 2017 2:52 PM
    Monday, April 17, 2017 2:46 PM

All replies

  • Ok. So I still don't know if this is a bug or "feature", but I'm too impatient so I switched to UWP. Anyway I'm still curious about this, so if anyone has any information, please reply.

    About how I sorted out the file access - I just let the user find the file manually through the picker. I've had some problems with accessing a file in use, but one lovely person noticed that I've missed the StorageOpenOptions parameter.

    Tuesday, April 18, 2017 11:08 PM
  • Seems like this is a bug multiple developers are stumbling upon (including me):
    • Edited by anlumo Tuesday, April 25, 2017 12:18 AM
    Tuesday, April 25, 2017 12:17 AM