Bug 13530 - Core Bluetooth UpdateValue args must not be null
Summary: Core Bluetooth UpdateValue args must not be null
Status: VERIFIED FIXED
Alias: None
Product: iOS
Classification: Xamarin
Component: Xamarin.iOS.dll ()
Version: 6.9.3.x
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2013-07-26 16:53 UTC by Vincent Bellet
Modified: 2014-04-14 08:03 UTC (History)
3 users (show)

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

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:
Status:
VERIFIED FIXED

Description Vincent Bellet 2013-07-26 16:53:55 UTC
**SUMUP :**

In the CBPeripheralManager class there is Assertion non consistent with Apple implementation.

**DETAILS :**

public virtual bool UpdateValue (NSData value, CBMutableCharacteristic characteristic, CBCentral[] subscribedCentrals)

In the bindings, an assertion check if subscribedCentrals is not null.

According to objectiveC documentation and samples, it can be null and more importantly it will broadcast the new characteristic value to all connected centrals.I need that :/

**PROOF**
Taken from iOS7 documentation :

"centrals;
A list of centrals (represented by CBCentral objects) that have subscribed to receive updates of the characteristic’s value. If nil, all subscribed centrals are updated. Centrals that have not subscribed to a characteristic’s value are ignored."

**FIX proposal :** 

remove the following assertion of the binding.

if (subscribedCentrals == null)
{
     throw new ArgumentNullException ("subscribedCentrals");
}
Comment 1 Rolf Bjarne Kvinge [MSFT] 2013-07-29 19:19:56 UTC
Fixed.

monotouch/master-3.0: 481ad7d2e19bd94a0c7f6660ac51cba2fb0d3bc5
monotouch/monotouch-6.4-series: 91c729bfa34b080d821ff1a9251e3eed5a23a684

The next release with this fix will be 6.4.2.
Comment 2 Vincent Bellet 2013-07-30 10:27:54 UTC
thanks.
Comment 3 Sadik Ali 2014-04-14 08:03:52 UTC
I have checked this issue with master builds:

Mac OS X 10.9.2
Xamarin.iOS : 7.2.2.120 
Xamarin Studio: 4.2.4 (build 367)
Build Information
Release ID: 402040367
Git revision: e804253f96eb73e59d1c8f5e4393897b7b9004bc
Build date: 2014-04-10 10:48:00-04
Xamarin addins: 9924a0f4aaf47d7ac2f41183a5467a1c30018300

When I open the definition of "UpdateValue" method of CBPeripheralManager class in "assembly browser" I observed that the "UpdateValue" doesn't check the following condition:
 
if (subscribedCentrals == null)
{
     throw new ArgumentNullException ("subscribedCentrals");
}

Now,"CBCentral[] subscribedCentrals" can be null and it doesn't throw "ArgumentNullException" exception when argument is null.

Screencast:http://www.screencast.com/t/uZrfOmsalv

This issue is working fine. Hence, I am closing this issue.