BLE in Windows Application (UWP)
See original GitHub issueFollowing 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
-
Add Plugin.BLE / MvvmCross.Plugin.BLE via NuGet to Windows Application VS solution.
-
Attempt to initialize with either the ‘Vanilla’ or ‘MvvmCross’ calls to init BLE.
-
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:
- Created 4 years ago
- Comments:21 (10 by maintainers)
Top GitHub Comments
@emanuelevaini @fomlhaut I created PR #640, which is supposed to fix this problem. Testing and feedback welcome!
@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 …