Closed swlasse closed 6 months ago
FWIW: I just updated our project to use the newly released 3.3.0 version of Shiny.BluetoothLE
and I can confirm that the above issue has now been resolved - thanks again for your awesome work on this project.
Thank you for confirming. I wish more people did this!
Component/Nuget
BluetoothLE Client (Shiny.BluetoothLE)
What operating system(s) are effected?
Version(s) of Operation Systems
Android 14 (API level 34) is the OS I have available for testing, however, this bug is likely to affect all OS'es.
Hosting Model
Steps To Reproduce
<PackageReference Include="Shiny.BluetoothLE" Version="3.2.4" />
):Throws:
Expected Behavior
Expected to support registration of the BLE services even when other keyed registrations exists in the service collection.
From what I can tell, the behavior of
ServiceDescriptor
has changed in .NET 8 - see this related issue / discussion: https://github.com/dotnet/runtime/issues/95789#issuecomment-1856096964Actual Behavior
In Shiny, the call to
ServiceCollectionExtensions.AddBluetoothLE()
is callingservices.HasImplementation<BleManager>()
which is doing this:... which, according to: https://github.com/dotnet/runtime/issues/95789#issuecomment-1856096964 is no longer allowed on a keyed descriptor.
Other libraries (from other projects) are now also failing because of this change, but a proposed fix from: https://github.com/AzureAD/microsoft-identity-web/pull/2676/files#diff-1cc266edfdfa6f7443d29d8bb2c6492da93bd6a8d410e1004d8429f9e2ec1c32R143-R151 ... looks like this:
A simple workaround (hack) for me that "works", was to flip the order of registrations, so the keyed registration comes after, but one might not be in a position where that is easily done (nor desired), hence raising this issue for awareness.
Please let me know if something is unclear.
Thanks again for your hard work on this project!
Exception or Log output
No response
Code Sample
No response
Code of Conduct