Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NullReferenceException thrown in WinRT.Runtime.dll calling GattCharacteristic.WriteValueAsync in .NET 5 #975

Closed
AndyCW opened this issue Aug 25, 2021 · 1 comment
Labels
bug Something isn't working

Comments

@AndyCW
Copy link

AndyCW commented Aug 25, 2021

Describe the bug
Using the Windows.Devices.Bluetooth apis to write to a GattCharacteristic of a Bluetooth LE Service, using the Windows.Devices.Bluetooth.GenericAttributeProfile.GattCharacteristic.WriteValueAsync API. Code works in .NET Framework 4.7.2, same code fails in .NET 5 with NullReferenceException thrown

To Reproduce

  1. Create a .NET 5 Console app
  2. Set TargetFramework in the csproj file to net5-windows10.0.19041.0
  3. Use
    Program.zip
  4. Modify Guids in code to match your Bluetooth LE device service and Gatt characteristic
  5. Run - observe exception
  6. Repeat, but with .NET Framework 4.7.2 console app, adding Windows SDK reference using the Microsoft.Windows.SDK.Contracts NuGet package. Observe that that works.

Expected behavior
.Net 5 app should run to completion successfully

Version Info
Visual Studio 2019, .Net 5, net5-windows10.0.19041.0

Additional context

@AndyCW AndyCW added the bug Something isn't working label Aug 25, 2021
@angelazhangmsft
Copy link
Contributor

This looks like a duplicate of #755. The fix for that issue will be available in a future .NET SDK update.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants