Bug 5808 - CBCentralManager.ScanForPeripherals(null, null) not working as expected
Summary: CBCentralManager.ScanForPeripherals(null, null) not working as expected
Alias: None
Product: iOS
Classification: Xamarin
Component: Xamarin.iOS.dll ()
Version: 5.3.x
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
Depends on:
Reported: 2012-06-21 15:43 UTC by Kirk Klobe
Modified: 2012-07-25 11:28 UTC (History)
3 users (show)

Tags: CoreBluetooth
Is this bug a regression?: ---
Last known good build:

testcase code (3.88 KB, application/x-gzip)
2012-06-21 15:43 UTC, Kirk Klobe

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Kirk Klobe 2012-06-21 15:43:01 UTC
Using Objective-C, a scan for all peripherals can be started with:

[self.manager scanForPeripheralsWithServices:nil options:nil];

However, using MT, the following causes an exception:

manager.ScanForPeripherals (null, null);

I would expect this to work. Instead, the serviceUuids parameter is required to be non-null.

The exception thrown is:

System.ArgumentNullException: Argument cannot be null.
Parameter name: serviceUuids
  at MonoTouch.CoreBluetooth.CFUUID.WithArray (System.Guid[] uuids, System.String argName, System.Action`1 action) [0x0009b] in /Developer/MonoTouch/Source/monotouch/src/CoreBluetooth/GuidWrapper.cs:37
  at MonoTouch.CoreBluetooth.CBCentralManager.ScanForPeripherals (System.Guid[] serviceUuids, MonoTouch.Foundation.NSDictionary options) [0x00014] in /Developer/MonoTouch/Source/monotouch/src/CoreBluetooth/GuidWrapper.cs:50
  at Starkey.Bluetooth.SBManager.StartScan () [0x00007] in /Users/kklobe/src/MTbtlesuite/SBManager/SBManager.cs:36
  at MTbtlesuite.AppDelegate.UpdateScanningState () [0x00028] in /Users/kklobe/src/MTbtlesuite/MTbtlesuite/AppDelegate.cs:45
  at MTbtlesuite.AppDelegate.ButtonPressed (System.Object sender, System.EventArgs e) [0x00000] in /Users/kklobe/src/MTbtlesuite/MTbtlesuite/AppDelegate.cs:68
  at MonoTouch.UIKit.UIBarButtonItem+Callback.Call (MonoTouch.Foundation.NSObject sender) [0x00010] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIBarButtonItem.cs:23
  at MonoTouch.UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x00042] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIApplication.cs:29
  at MTbtlesuite.Application.Main (System.String[] args) [0x00000] in /Users/kklobe/src/MTbtlesuite/MTbtlesuite/Main.cs:17
Comment 1 Kirk Klobe 2012-06-21 15:43:21 UTC
Created attachment 2098 [details]
testcase code
Comment 2 Rolf Bjarne Kvinge [MSFT] 2012-06-21 18:04:50 UTC
Fixed. The next releases with this fix included will be 5.2.13 and 5.3.5.

master: 3cc8988c87fb30238b3e0c520293fe73cc8b413b
5.2-series: 8022fdad2d1285584a274d060fa3818109523b0d