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.
I see two issues in the CoreBluetooth api in MT.
1. I am subclassing CBCentralManagerDelegate for some Bluetooth work and I see that there is a RetrievedConnectedPeripherals method that takes in a CBPeripheral named "peripherals". I believe that this should actually take in a CBPeripheral just as the Objective C implementation does and just as the MT RetrievedPeripherals method does on the same class.
2. I invoke RetrieveConnectedPeripherals() on my CBCentralManager and I do get a callback in my RetrievedConnectedPeripherals method on my CBCentralManagerDelegate--and the peripherals parameter is not null (even though I'm not connected to anything). But it is also not exactly empty either. If I do a Console.WriteLine(peripherals.Name) I get a SIGSEGV crash.
I'm on the stable branch of MonoDevelop--and I believe I am up-to-date: MonoDevelop 18.104.22.168, XCode 4.4.1, MonoTouch 5.4.0.
Steps to reproduce:
1. subclass CBCentralManagerDelegate
2. New up a CBCentralManager and give it an instance of your CBCentralManagerDelegate
3. on your CBCentralManager instance, call RetrieveConnectedPeripherals()
4. Add a null check on the peripherals parameter--if it is not null do Console.WriteLine(peripherals.Name);
4. Set a breakpoint inside of RetrievedConnectedPeripherals in your CBCentralManagerDelegate subclass.
5. Notice that peripherals is not null but that you get a on the Console.WriteLine(peripherals.Name) line
It's a binding bug. The parameter was changed from (the non-strongly typed) NSArray to "CBPeripheral " for RetrievedPeripherals. However the "" was not added for RetrievedConnectedPeripherals.
That's also causing the SIGSEGV later - because the marshaling is based on the (wrong) definition.
If you wish to try an hotfix just reply to the bug report and I'll attach one once our buildbots have processed the commit.
How would I go about getting this in a hotfix?
Created attachment 2509 [details]
To use the attached assembly (on top of MonoTouch 5.4.0) do:
1) backup your /Developer/MonoTouch/usr/lib/mono/2.1/monotouch.dll and /Developer/MonoTouch/usr/lib/mono/2.1/monotouch.dll.mdb files
2) copy (and rename) the attached file to /Developer/MonoTouch/usr/lib/mono/2.1/monotouch.dll
3) remove the /Developer/MonoTouch/usr/lib/mono/2.1/monotouch.dll.mdb symbols (they won't match anymore)
4) clean, rebuild and test your application