Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
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
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.
After creating an instance of CBCentralManager with a CBCentralManagerDelegate, the delegate's UpdatedState method is never called.
This doesnt work:
cbCentralManager = new CBCentralManager(new CentralManager(), null);
nor did this:
cbCentralManager = new CBCentralManager();
cbCentralManager.Delegate = new CentralManager();
I created the same code in Objective C:
manager = [[CBCentralManager alloc] initWithDelegate:self queue:nil];
And saw that the delegate's centralManagerDidUpdateState method getting called.
Not entirely sure why, but it now appears to be working, the delegate method is being called.
Found what causes it to not be fired, if trying to connect the events right after creation:
this.centralManager = new CoreBluetoothCentralManager(uuid);
//this.centralManager.CentralManager.DiscoveredPeripheral += handleDiscoveredPeripheral;
Uncommenting the line where the discoveredperipheral event is hooked up will cause the CBCentralManagerDelegate to not be called.
The .NET events that Xamarin.iOS provides are possible because an internal *Delegate type is used, see  for more details. That internal *Delegate type is called by ObjC and the code routes those call those the .NET events.
That also means you cannot mix those .NET events with your own custom *Delegate type. One (the later) will replace the other (the former) - because it's not possible to have two *Delegate set on the same instance.
So if you want to use events you must not assign a delegate, e.g.
> var cb = new CBCentralManager ();
> cb.DiscoveredPeripheral += handleDiscoveredPeripheral;
Otherwise you use your own *Delegate type and override the methods you need (or are required to implement).
> var cb = new CBCentralManager (new MyCBCentrealManagerDelegate ());
Ah ok, that makes sense. Because I didn't see an event to handle the update status, I assumed that you still had to create the delegate class to handle it.
There's a `UpdatedState` event for that :-)
Then I see that you guys have done all the hard work for me. I should have never doubted you.