question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

BLE in Windows Application (UWP)

See original GitHub issue

Following the readme, under header “## Usage” we are stuck at initializing the plug-in.

So- How to address portable version of this assembly in a Windows application? or/and Where to initialize Mvx.Resolve in a Windows Application?

Steps to reproduce

  1. Add Plugin.BLE / MvvmCross.Plugin.BLE via NuGet to Windows Application VS solution.

  2. Attempt to initialize with either the ‘Vanilla’ or ‘MvvmCross’ calls to init BLE.

  3. Error(s) will produce

Expected behavior

Tell us what should happen Run

Actual behavior

Tell us what happens instead Errors out

Crashlog

If something causes an exception paste full stack trace + Exception here

//**Vanilla**
try
{
    var ble = CrossBluetoothLE.Current;
    var adapter = CrossBluetoothLE.Current.Adapter;
}
catch (Exception ex)
{
    Console.WriteLine(ex.Message);
}

| Name | Value | Type – | – | – | –   | Message | “This functionality is not implemented in the portable version of this assembly. You should reference the NuGet package from your main application project in order to reference the platform-specific implementation.” | string

| Name | Value | Type – | – | – | –   | StackTrace | " at Plugin.BLE.CrossBluetoothLE.get_Current()\r\n at MyWindowsApp.Source.Logic.InitBLE() in C:\…\MyWindowsApp\Source\Logic.cs:line 116" | string

//**MvvmCross**
try
{
    var ble = Mvx.Resolve<IBluetoothLE>();
    var adapter = Mvx.Resolve<IAdapter>();
}
catch (Exception ex)
{
    Console.WriteLine(ex.Message);
}

| Name | Value | Type – | – | – | –   | Message | “Object reference not set to an instance of an object.” | string

| Name | Value | Type – | – | – | –   | StackTrace | " at MvvmCross.Platform.Mvx.ResolveTService\r\n at MyWindowsApp.Source.Logic.InitBLE() in C:\…\MyWindowsApp\Source\Logic.cs:line 127" | string

Configuration

Version of the Plugin: e.g. 1.0.0 / 1.0.1-alpha3 1.3.0

Platform: e.g. iOS 10.1 / Android 4.4 / … (including version!!! e.g. Android 5.1 / i0S 10) Windows Application using .NET Framework (targets 4.5.1)

Device: e.g. HTC Sensation /i Phone 7 … PC running Windows 10

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:21 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
januswcommented, Nov 23, 2022

@emanuelevaini @fomlhaut I created PR #640, which is supposed to fix this problem. Testing and feedback welcome!

1reaction
januswcommented, Nov 23, 2022

@fomlhaut Thanks for your analysis! I think you’re absolutely right. We need to obtain the DispatcherQueue on the UI thread. I think I know how to fix this. Will create a PR tonight …

Read more comments on GitHub >

github_iconTop Results From Across the Web

Bluetooth Low Energy in Universal Windows Platform apps
Learn about the Bluetooth Low Energy (LE) specification in UWP apps that defines protocols for discovery and communication between ...
Read more >
Bluetooth LE Advertisements - UWP applications
This topic provides an overview of Bluetooth Low Energy (LE) Advertisement beacons for Universal Windows Platform (UWP) apps.
Read more >
Bluetooth Low Energy sample
Shows how to use the Windows Bluetooth LE APIs to act either as a BLE client or server. Note: This sample is part...
Read more >
Bluetooth - UWP applications
This section contains articles on how to integrate Bluetooth into Universal Windows Platform (UWP) apps, including how to use RFCOMM, GATT, ...
Read more >
Bluetooth GATT Server - UWP applications
Learn about the Bluetooth Low Energy (LE) specification in UWP apps that defines protocols for discovery and communication between power- ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found