This could be related to your situation:
https://developercommunity.visualstudio.com/t/ble-using-winrt-access-denied-when-executing-getch/1703310
[Possible solution at the last EDIT]
But it can be altogether a different thing.
In my case (using Windows 10, but not an UWP application, calling WinRT libs) this happens:
Only the first call gives me the attributes, then "Access Denied".
After some time a single call will give a valid answer again, but it's pretty rare (in one case after 52 seconds, in another 21 seconds).
In this case I will try to make a solution when everytime I'm asking for data, I will build the BLE from ground up (device detection, looking for correct device, getting attributes), get the data and then destroy everything, then do it again everytime I need data from a device.
This feels very wrong and could lead to more problems.
The reasoning behind this that the first time I collect information, everything is accessible.
Hope this helps someone.
EDIT1: This is not the case for every Characteristics! For example.: "Battery Level" works every time, but some other characteristics have this behaviour (but only on Windows devices, an Android phone or tablet works everytime, with every characteristic).
EDIT2: The problem is at a deeper level. Rebuilding the connection from zero each time does not solve the problem. The second time I still can't have the data. But with every program start it works.
EDIT3: SOLUTION!
Dispose is the key! After the first request you have to Dispose both the BluetoothLEDevice and the GattDeviceService you get while connecting! The system thinks it is still inuse!
I'd like to add to this a 'code snippit' (Only tested with 1 device here, will look at the bluetooth logs and add later)
The code snippit is the BluetoothLE Explorer app from the Microsoft Store and the code from Github.
When scanning a device, the code hangs in the ObservableGattDeviceServices.cs file line 211.
This line tries the await Service.OpenAsync(GattSharingMode.SharedReadAndWrite). This function never returns.
On Windows 10 with the same device, all is fine.