TimoKinnunen / MauiXAMLBluetoothLE

.Net MAUI app using Plugin.BLE for Polar H10 Heart Rate Sensor. Bluetooth LE working solution on Android.
52 stars 12 forks source link

Code will only run on Android. Fails on iOS. #2

Open jdg3k92 opened 2 years ago

jdg3k92 commented 2 years ago

I had downloaded your sample application which show cases Plugin.BLE for Maui. (very neat, clean, well written)

Below is my experience with trying to run the application on a Mac in iOS Simulator (and tethered too). Maybe you can provide some guiadance....maybe not. Maui is very new and I am looking at it as a replacement for our Aging Xamarin forms application which is completely dependenty on Cross-Platform BLE support.

Thanks.

Steps to reproduce

  1. Install Visual Studio 2022 for Mac (17.3.7)

  2. Clone THIS repo and open in VS.

  3. Build and run on ios simulator

Expected behavior

The App should load and display the landing page in iOS Simulator (Works fine for Android Simulator and Real Android device)

Actual behavior

code blows up and throws exception. Main message is the following:

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.

Crashlog

at Plugin.BLE.CrossBluetoothLE.get_Current() at MauiXAMLBluetoothLE.Services.BluetoothLEService..ctor() in /Users/fjb/Projects/MauiXAMLBluetoothLE-master/MauiXAMLBluetoothLE/Services/BluetoothLEService.cs:line 13 at System.Reflection.RuntimeConstructorInfo.InternalInvoke(Object obj, Object[] parameters, Boolean wrapExceptions) at System.Reflection.RuntimeConstructorInfo.DoInvoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, RuntimeResolverContext context) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor2[[Microsoft.Extensions.DependencyInjection.ServiceLookup.RuntimeResolverContext, Microsoft.Extensions.DependencyInjection, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60],[System.Object, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].VisitCallSiteMain(ServiceCallSite callSite, RuntimeResolverContext argument) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitRootCache(ServiceCallSite callSite, RuntimeResolverContext context) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor2[[Microsoft.Extensions.DependencyInjection.ServiceLookup.RuntimeResolverContext, Microsoft.Extensions.DependencyInjection, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60],[System.Object, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].VisitCallSite(ServiceCallSite callSite, RuntimeResolverContext argument) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, RuntimeResolverContext context) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor2[[Microsoft.Extensions.DependencyInjection.ServiceLookup.RuntimeResolverContext, Microsoft.Extensions.DependencyInjection, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60],[System.Object, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].VisitCallSiteMain(ServiceCallSite callSite, RuntimeResolverContext argument) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitRootCache(ServiceCallSite callSite, RuntimeResolverContext context) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor2[[Microsoft.Extensions.DependencyInjection.ServiceLookup.RuntimeResolverContext, Microsoft.Extensions.DependencyInjection, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60],[System.Object, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].VisitCallSite(ServiceCallSite callSite, RuntimeResolverContext argument) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, RuntimeResolverContext context) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor2[[Microsoft.Extensions.DependencyInjection.ServiceLookup.RuntimeResolverContext, Microsoft.Extensions.DependencyInjection, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60],[System.Object, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].VisitCallSiteMain(ServiceCallSite callSite, RuntimeResolverContext argument) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitRootCache(ServiceCallSite callSite, RuntimeResolverContext context) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor2[[Microsoft.Extensions.DependencyInjection.ServiceLookup.RuntimeResolverContext, Microsoft.Extensions.DependencyInjection, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60],[System.Object, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].VisitCallSite(ServiceCallSite callSite, RuntimeResolverContext argument) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.Resolve(ServiceCallSite callSite, ServiceProviderEngineScope scope) at Microsoft.Extensions.DependencyInjection.ServiceProvider.CreateServiceAccessor(Type serviceType) at System.Collections.Concurrent.ConcurrentDictionary2[[System.Type, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.Func2[[Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngineScope, Microsoft.Extensions.DependencyInjection, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60],[System.Object, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].GetOrAdd(Type key, Func`2 valueFactory) at Microsoft.Extensions.DependencyInjection.ServiceProvider.GetService(Type serviceType, ServiceProviderEngineScope serviceProviderEngineScope) at Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngineScope.GetService(Type serviceType) at Microsoft.Maui.MauiContext.WrappedServiceProvider.GetService(Type serviceType) at Microsoft.Maui.Controls.ShellContent.<>c__DisplayClass19_0.b__0() at Microsoft.Maui.Controls.ElementTemplate.CreateContent() at Microsoft.Maui.Controls.Internals.DataTemplateExtensions.CreateContent(DataTemplate self, Object item, BindableObject container) at Microsoft.Maui.Controls.ShellContent.Microsoft.Maui.Controls.IShellContentController.GetOrCreateContent() at Microsoft.Maui.Controls.Platform.Compatibility.ShellSectionRootRenderer.LoadRenderers() at Microsoft.Maui.Controls.Platform.Compatibility.ShellSectionRootRenderer.ViewDidLoad() at UIKit.UIApplication.Main(String[] args, Type principalClass, Type delegateClass) at MauiXAMLBluetoothLE.Program.Main(String[] args) in /Users/fjb/Projects/MauiXAMLBluetoothLE-master/MauiXAMLBluetoothLE/Platforms/iOS/Program.cs:line 13

Configuration

Version of the Plugin: 2.1.3

Platform: e.g. iOS 15.5 / Android 12

Screen Shot 2022-10-13 at 11 03 17 PM Screen Shot 2022-10-13 at 11 07 30 PM
TimoKinnunen commented 2 years ago

Hej

Sorry, no help from me. I don’t own iPhone or Mac. Android works. I am waiting .Net MAUI to mature.

I want to build an app for Android, iOS and Windows using .Net MAUI and Bluetooth LE and only Android is working so far.

Regards Timo

Skickades från E-post för Windows

Från: jdg3k92 Skickat: den 14 oktober 2022 05:27 Till: TimoKinnunen/MauiXAMLBluetoothLE Kopia: Subscribed Ämne: [TimoKinnunen/MauiXAMLBluetoothLE] Code will only run on Android. Fails on iOS. (Issue #2)

I had downloaded your sample application which show cases Plugin.BLE for Maui. Below is my experience with trying to run the application on a Mac in iOS Simulator (and tethered too). Maybe you can provide some guiadance....maybe not. Maui is very new and I am looking at it as a replacement for our Aging Xamarin forms application which is completely dependenty on Cross-Platform BLE support. Thanks. Steps to reproduce

  1. Install Visual Studio 2022 for Mac (17.3.7)
  2. Clone THIS repo and open in VS.
  3. Build and run on ios simulator Expected behavior The App should load and display the landing page in iOS Simulator (Works fine for Android Simulator and Real Android device) Actual behavior code blows up and throws exception. Main message is the following: 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. Crashlog at Plugin.BLE.CrossBluetoothLE.get_Current() at MauiXAMLBluetoothLE.Services.BluetoothLEService..ctor() in /Users/jgeshrick/Projects/MauiXAMLBluetoothLE-master/MauiXAMLBluetoothLE/Services/BluetoothLEService.cs:line 13 at System.Reflection.RuntimeConstructorInfo.InternalInvoke(Object obj, Object[] parameters, Boolean wrapExceptions) at System.Reflection.RuntimeConstructorInfo.DoInvoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, RuntimeResolverContext context) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor2[[Microsoft.Extensions.DependencyInjection.ServiceLookup.RuntimeResolverContext, Microsoft.Extensions.DependencyInjection, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60],[System.Object, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].VisitCallSiteMain(ServiceCallSite callSite, RuntimeResolverContext argument) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitRootCache(ServiceCallSite callSite, RuntimeResolverContext context) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor2[[Microsoft.Extensions.DependencyInjection.ServiceLookup.RuntimeResolverContext, Microsoft.Extensions.DependencyInjection, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60],[System.Object, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].VisitCallSite(ServiceCallSite callSite, RuntimeResolverContext argument) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, RuntimeResolverContext context) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor2[[Microsoft.Extensions.DependencyInjection.ServiceLookup.RuntimeResolverContext, Microsoft.Extensions.DependencyInjection, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60],[System.Object, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].VisitCallSiteMain(ServiceCallSite callSite, RuntimeResolverContext argument) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitRootCache(ServiceCallSite callSite, RuntimeResolverContext context) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor2[[Microsoft.Extensions.DependencyInjection.ServiceLookup.RuntimeResolverContext, Microsoft.Extensions.DependencyInjection, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60],[System.Object, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].VisitCallSite(ServiceCallSite callSite, RuntimeResolverContext argument) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, RuntimeResolverContext context) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor2[[Microsoft.Extensions.DependencyInjection.ServiceLookup.RuntimeResolverContext, Microsoft.Extensions.DependencyInjection, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60],[System.Object, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].VisitCallSiteMain(ServiceCallSite callSite, RuntimeResolverContext argument) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitRootCache(ServiceCallSite callSite, RuntimeResolverContext context) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor2[[Microsoft.Extensions.DependencyInjection.ServiceLookup.RuntimeResolverContext, Microsoft.Extensions.DependencyInjection, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60],[System.Object, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].VisitCallSite(ServiceCallSite callSite, RuntimeResolverContext argument) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.Resolve(ServiceCallSite callSite, ServiceProviderEngineScope scope) at Microsoft.Extensions.DependencyInjection.ServiceProvider.CreateServiceAccessor(Type serviceType) at System.Collections.Concurrent.ConcurrentDictionary2[[System.Type, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.Func2[[Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngineScope, Microsoft.Extensions.DependencyInjection, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60],[System.Object, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].GetOrAdd(Type key, Func`2 valueFactory) at Microsoft.Extensions.DependencyInjection.ServiceProvider.GetService(Type serviceType, ServiceProviderEngineScope serviceProviderEngineScope) at Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngineScope.GetService(Type serviceType) at Microsoft.Maui.MauiContext.WrappedServiceProvider.GetService(Type serviceType) at Microsoft.Maui.Controls.ShellContent.<>c__DisplayClass19_0.b__0() at Microsoft.Maui.Controls.ElementTemplate.CreateContent() at Microsoft.Maui.Controls.Internals.DataTemplateExtensions.CreateContent(DataTemplate self, Object item, BindableObject container) at Microsoft.Maui.Controls.ShellContent.Microsoft.Maui.Controls.IShellContentController.GetOrCreateContent() at Microsoft.Maui.Controls.Platform.Compatibility.ShellSectionRootRenderer.LoadRenderers() at Microsoft.Maui.Controls.Platform.Compatibility.ShellSectionRootRenderer.ViewDidLoad() at UIKit.UIApplication.Main(String[] args, Type principalClass, Type delegateClass) at MauiXAMLBluetoothLE.Program.Main(String[] args) in /Users/jgeshrick/Projects/MauiXAMLBluetoothLE-master/MauiXAMLBluetoothLE/Platforms/iOS/Program.cs:line 13 Configuration Version of the Plugin: 2.1.3 Platform: e.g. iOS 15.5 / Android 12

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you are subscribed to this thread.Message ID: @.***>

jdg3k92 commented 2 years ago

Timo,

Thanks. You’ve done a great job so far. I think you are right; Maui is not yet what it needs to be. However, you should stay on top of this because many people are going to be looking for a solution to this problem. I’ll keep an eye on your repo for updates.

JDG

On Fri, Oct 14, 2022 at 7:43 AM Timo Kinnunen @.***> wrote:

Hej

Sorry, no help from me. I don’t own iPhone or Mac. Android works. I am waiting .Net MAUI to mature.

I want to build an app for Android, iOS and Windows using .Net MAUI and Bluetooth LE and only Android is working so far.

Regards Timo

Skickades från E-post för Windows

Från: jdg3k92 Skickat: den 14 oktober 2022 05:27 Till: TimoKinnunen/MauiXAMLBluetoothLE Kopia: Subscribed Ämne: [TimoKinnunen/MauiXAMLBluetoothLE] Code will only run on Android. Fails on iOS. (Issue #2)

I had downloaded your sample application which show cases Plugin.BLE for Maui. Below is my experience with trying to run the application on a Mac in iOS Simulator (and tethered too). Maybe you can provide some guiadance....maybe not. Maui is very new and I am looking at it as a replacement for our Aging Xamarin forms application which is completely dependenty on Cross-Platform BLE support. Thanks. Steps to reproduce

  1. Install Visual Studio 2022 for Mac (17.3.7)
  2. Clone THIS repo and open in VS.
  3. Build and run on ios simulator Expected behavior The App should load and display the landing page in iOS Simulator (Works fine for Android Simulator and Real Android device) Actual behavior code blows up and throws exception. Main message is the following: 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. Crashlog at Plugin.BLE.CrossBluetoothLE.get_Current() at MauiXAMLBluetoothLE.Services.BluetoothLEService..ctor() in /Users/jgeshrick/Projects/MauiXAMLBluetoothLE-master/MauiXAMLBluetoothLE/Services/BluetoothLEService.cs:line 13 at System.Reflection.RuntimeConstructorInfo.InternalInvoke(Object obj, Object[] parameters, Boolean wrapExceptions) at System.Reflection.RuntimeConstructorInfo.DoInvoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, RuntimeResolverContext context) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor2[[Microsoft.Extensions.DependencyInjection.ServiceLookup.RuntimeResolverContext, Microsoft.Extensions.DependencyInjection, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60],[System.Object, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].VisitCallSiteMain(ServiceCallSite callSite, RuntimeResolverContext argument) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitRootCache(ServiceCallSite callSite, RuntimeResolverContext context) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor2[[Microsoft.Extensions.DependencyInjection.ServiceLookup.RuntimeResolverContext, Microsoft.Extensions.DependencyInjection, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60],[System.Object, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].VisitCallSite(ServiceCallSite callSite, RuntimeResolverContext argument) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, RuntimeResolverContext context) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor2[[Microsoft.Extensions.DependencyInjection.ServiceLookup.RuntimeResolverContext, Microsoft.Extensions.DependencyInjection, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60],[System.Object, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].VisitCallSiteMain(ServiceCallSite callSite, RuntimeResolverContext argument) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitRootCache(ServiceCallSite callSite, RuntimeResolverContext context) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor2[[Microsoft.Extensions.DependencyInjection.ServiceLookup.RuntimeResolverContext, Microsoft.Extensions.DependencyInjection, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60],[System.Object, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].VisitCallSite(ServiceCallSite callSite, RuntimeResolverContext argument) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, RuntimeResolverContext context) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor2[[Microsoft.Extensions.DependencyInjection.ServiceLookup.RuntimeResolverContext, Microsoft.Extensions.DependencyInjection, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60],[System.Object, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].VisitCallSiteMain(ServiceCallSite callSite, RuntimeResolverContext argument) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitRootCache(ServiceCallSite callSite, RuntimeResolverContext context) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor2[[Microsoft.Extensions.DependencyInjection.ServiceLookup.RuntimeResolverContext, Microsoft.Extensions.DependencyInjection, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60],[System.Object, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].VisitCallSite(ServiceCallSite callSite, RuntimeResolverContext argument) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.Resolve(ServiceCallSite callSite, ServiceProviderEngineScope scope) at Microsoft.Extensions.DependencyInjection.ServiceProvider.CreateServiceAccessor(Type serviceType) at System.Collections.Concurrent.ConcurrentDictionary2[[System.Type, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.Func2[[Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngineScope, Microsoft.Extensions.DependencyInjection, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60],[System.Object, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].GetOrAdd(Type key, Func`2 valueFactory) at Microsoft.Extensions.DependencyInjection.ServiceProvider.GetService(Type serviceType, ServiceProviderEngineScope serviceProviderEngineScope) at Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngineScope.GetService(Type serviceType) at Microsoft.Maui.MauiContext.WrappedServiceProvider.GetService(Type serviceType) at Microsoft.Maui.Controls.ShellContent.<>c__DisplayClass19_0.b__0() at Microsoft.Maui.Controls.ElementTemplate.CreateContent() at Microsoft.Maui.Controls.Internals.DataTemplateExtensions.CreateContent(DataTemplate self, Object item, BindableObject container) at Microsoft.Maui.Controls.ShellContent.Microsoft.Maui.Controls.IShellContentController.GetOrCreateContent() at Microsoft.Maui.Controls.Platform.Compatibility.ShellSectionRootRenderer.LoadRenderers() at Microsoft.Maui.Controls.Platform.Compatibility.ShellSectionRootRenderer.ViewDidLoad() at UIKit.UIApplication.Main(String[] args, Type principalClass, Type delegateClass) at MauiXAMLBluetoothLE.Program.Main(String[] args) in /Users/jgeshrick/Projects/MauiXAMLBluetoothLE-master/MauiXAMLBluetoothLE/Platforms/iOS/Program.cs:line 13 Configuration Version of the Plugin: 2.1.3 Platform: e.g. iOS 15.5 / Android 12

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you are subscribed to this thread.Message ID: @.***>

— Reply to this email directly, view it on GitHub https://github.com/TimoKinnunen/MauiXAMLBluetoothLE/issues/2#issuecomment-1278893978, or unsubscribe https://github.com/notifications/unsubscribe-auth/A3TGVTTDBKZQBOU5DSBNGPTWDFBM5ANCNFSM6AAAAAARE3CKCE . You are receiving this because you authored the thread.Message ID: @.***>

janusw commented 1 year ago

This problem should be fixed by updating Plugin.BLE to 3.0.0-beta.1. @jdg3k92, can you confirm that?

TimoKinnunen commented 1 year ago

I can not confirm that Plugin.BLE 3.0.0-beta.1 will find Bluetooth LE on Windows. Plugin.BLE 3.0.0-beta.1 is better though than Plugin.BLE, no exception is thrown on Windows. Android emulator and Android smartphone is ok. iOS is not tested on my behalf.

janusw commented 1 year ago

I can not confirm that Plugin.BLE 3.0.0-beta.1 will find Bluetooth LE on Windows.

Well, yeah, beta.1 does not fix everything on Windows yet, but the exception on iOS (as reported above) should be gone. I will push a beta.2 release soon with further fixes for Windows.

TimoKinnunen commented 1 year ago

It sounds nice. Good work.

jdg3k92 commented 1 year ago

Thanks. I’ll try it out soon

On Wed, Nov 23, 2022 at 4:09 PM Janus Weil @.***> wrote:

This problem should be fixed by updating Plugin.BLE to 3.0.0-beta.1. @jdg3k92 https://github.com/jdg3k92, can you confirm that?

— Reply to this email directly, view it on GitHub https://github.com/TimoKinnunen/MauiXAMLBluetoothLE/issues/2#issuecomment-1325659468, or unsubscribe https://github.com/notifications/unsubscribe-auth/A3TGVTR2SCFKLLGXTNDXCTLWJ2BZRANCNFSM6AAAAAARE3CKCE . You are receiving this because you were mentioned.Message ID: @.***>

TimoKinnunen commented 1 year ago

Using PackageReference Include="Plugin.BLE" Version="3.0.0-beta.2": On Windows for example this does not work IReadOnlyList systemDevices = Adapter.GetSystemConnectedOrPairedDevices(HeartRateUuids.HeartRateServiceUuids); Result is systemDevices = 0; The good thing is no exceptions.

janusw commented 1 year ago

Using PackageReference Include="Plugin.BLE" Version="3.0.0-beta.2": On Windows for example this does not work IReadOnlyList systemDevices = Adapter.GetSystemConnectedOrPairedDevices(HeartRateUuids.HeartRateServiceUuids); Result is systemDevices = 0; The good thing is no exceptions.

See the comment at https://github.com/dotnet-bluetooth-le/dotnet-bluetooth-le/blob/f474528254bf227dc984477a9367aa088d17c301/Source/Plugin.BLE/Windows/Adapter.cs#L137-L143:

            //currently no way to retrieve paired and connected devices on windows without using an
            //async method. 

Seems this is a limitation of the current implementation for Windows. One would have to check the Windows APIs to see if there is a way to implement this. Please open a new issue in dotnet-bluetooth-le.

TimoKinnunen commented 1 year ago

You are right this is inside current implementation for Windows. And therefore a question for James Montemagno, I think. But how to reach James?

janusw commented 1 year ago

You are right this is inside current implementation for Windows. And therefore a question for James Montemagno, I think. But how to reach James?

I don't think it's a question for James in particular. As I said, please open an issue for this. You can mention James, if you think it helps.

rvalitov commented 1 year ago

Hi! I found this repository while googling for examples to work with Bluetooth LE in MAUI. I see here was no activity for 9 months. Does the latest beta work with ios? Or are there any recommendations how to use Bluetooth with ios too?

TimoKinnunen commented 1 year ago

Hello

My activity has been Microsoft Blazor lately and now image object detection.

The state of mentioned repository is what it was 9 months ago.

Regards Timo Kinnunen

Skickades från E-post för Windows

Från: Ramil Valitov Skickat: den 18 augusti 2023 14:35 Till: TimoKinnunen/MauiXAMLBluetoothLE Kopia: Timo Kinnunen; Comment Ämne: Re: [TimoKinnunen/MauiXAMLBluetoothLE] Code will only run on Android.Fails on iOS. (Issue #2)

Hi! I found this repository while googling for examples to work with Bluetooth LE in MAUI. I see here was no activity for 9 months. Does the latest beta work with ios? Or are there any recommendations how to use Bluetooth with ios too? — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>

ihassantariq commented 5 months ago

HeartRateMonitor.zip

Hey @jdg3k92 - I just did quick fixes for iOS and it worked perfectly.

TimoKinnunen commented 5 months ago

Good work. I program a Blazor web app for now and .net Maui sleeps.