Coming soon - Get a detailed view of why an account is flagged as spam!
view details

This post has been de-listed

It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.

2
[UWP] FromBluetoothAddressAsync throws 'System.IO.FileNotFoundException' in mscorlib.ni.dll
Author Summary
vixez is in UWP
Post Body

Hey,

I'm developing an app that connects ta a BLE beacon, for this I use the BluetoothLEAdvertisementWatcher API. When I receive an advertisement I want to connect to the device to read the GATT characteristics.

So I start a BLEwatcher

        BluetoothLEAdvertisementWatcher watcher;
        watcher.Received  = OnAdvertisementReceived;
        watcher.Stopped  = OnAdvertisementWatcherStopped;
        watcher.Start();

Then I try to access the device

    private async void OnAdvertisementReceived(BluetoothLEAdvertisementWatcher watcher, BluetoothLEAdvertisementReceivedEventArgs eventArgs)
    {
        var address = eventArgs.BluetoothAddress;

        BluetoothLEDevice device = await BluetoothLEDevice.FromBluetoothAddressAsync(eventArgs.BluetoothAddress);
        Debug.WriteLine(device.Name   " - "   device.DeviceId);
        ....

This fails with (at FromBluetoothAddressAsync line)

An exception of type 'System.IO.FileNotFoundException' occurred in mscorlib.ni.dll but was not handled in user code

Additional information: The system cannot find the file specified. (Exception from HRESULT: 0x80070002)    

The funny thing is: if I open the system's bluetooth devices window it works fine!

So when I open the bluetooth devices window and run the app the error is not thrown, when I close the bluetooth devices window it throws the error.

Anyone know a solution?

Apparently it does work on build 10.0.10586.218; /u/MkeyAllison & /u/jenmsft maybe this is something to add to the current build bugs list?

I found this online from someone with the same issue:

LUMIA 950, Windows 10, 1511, 10.0.14332.1001

Exception thrown on FromIdAsync(): 'System.IO.FileNotFoundException' in mscorlib.ni.dll


LUMIA 730, Windows 10, 1511, 10.0.10586.218

Exception thrown on FindAllAsync(): 'System.ArgumentException'


LUMIA 920, Windows 10, 1511, 10.0.10586.218

No Error!


Author
Account Strength
100%
Account Age
12 years
Verified Email
Yes
Verified Flair
No
Total Karma
5,424
Link Karma
873
Comment Karma
4,551
Profile updated: 4 days ago
Posts updated: 8 months ago

Subreddit

Post Details

Location
We try to extract some basic information from the post title. This is not always successful or accurate, please use your best judgement and compare these values to the post title and body for confirmation.
Posted
8 years ago