Skip to content
This repository was archived by the owner on Jun 20, 2025. It is now read-only.
This repository was archived by the owner on Jun 20, 2025. It is now read-only.

ArgumentException when calling GattDeviceService.GetCharacteristicsAsync #23

@NKnusperer

Description

@NKnusperer

Hallo everyone, I'm currently playing around with Bluetooth LE and observing this strange behavior when probing a device and calling GattDeviceService.GetCharacteristicsAsync on a service:
System.ArgumentException: 'Value does not fall within the expected range.'

My code:

var serviceId = Guid.Parse("04313ed3-8c7e-4e2e-9771-a415cd2b4623");
var bleDevice = await BluetoothLEDevice.FromBluetoothAddressAsync(228844339811492);
var gatt = await bleDevice.GetGattServicesAsync();
var service = gatt.Services.Single(e => e.Uuid == serviceId);
var accessStatus = await service.RequestAccessAsync(); // Allowed
var openStatus = await service.OpenAsync(GattSharingMode.SharedReadAndWrite); // Success
var characteristics = await service.GetCharacteristicsAsync(); // Crash

Using the Android BLE Scanner app I can clearly see the service and related characteristics:
image

I can also reproduce this issue when using the Bluetooth LE Explorer Windows app which is using the same API:
image

I can probe other devices (eg. my Bluetooth mice) without any problem so something must be special here.

I'm using the .NET SDK 6.0.400 with a console application targeting net6.0-windows10.0.19041.0 from within Visual Studio 2022 17.3.1.
I tested it on a Windows 11 (22000.856) notebook with an embedded Intel Bluetooth card and a Windows 10 (19044.1889) desktop using a generic USB Bluetooth dongle.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions