Bug 22618 - CBCentralManager ScanForPeripherals missing its native ObjectiveC class CBPeer on iOS 7
Summary: CBCentralManager ScanForPeripherals missing its native ObjectiveC class CBPee...
Status: RESOLVED FIXED
Alias: None
Product: iOS
Classification: Xamarin
Component: Xamarin.iOS.dll ()
Version: 7.9.2.x
Hardware: PC Mac OS
: Normal normal
Target Milestone: Untriaged
Assignee: Rolf Bjarne Kvinge [MSFT]
URL:
Depends on:
Blocks:
 
Reported: 2014-09-03 16:41 UTC by John Miller [MSFT]
Modified: 2014-09-04 16:08 UTC (History)
5 users (show)

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


Attachments
test Case (10.50 KB, application/zip)
2014-09-03 16:42 UTC, John Miller [MSFT]
Details


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:
RESOLVED FIXED

Description John Miller [MSFT] 2014-09-03 16:41:44 UTC
**Overview:**

   CBCentralManager.ScanForPeripherals throws an exception when running on iOS 7 with Xamarin.IOS 7.9.4.9

**Steps to Reproduce:**

   1. You may need bluetooth LE devices around for it to scan for. 
   2. Update the UUID for the LE devices
   3. Run the attached sample on an iOS 7 device 

**Actual Results:**

>BluetoothTest[241:60b] Unhandled managed exception: Wrapper type 'MonoTouch.CoreBluetooth.CBPeer' is missing its native >ObjectiveC class 'CBPeer'.

**Expected Results:**

   No Exception

**Build Date & Platform:**

   XI 7.9.4.9
   Xcode 6b7 and Xcode 5.1.1

**Additional Information:**

   Adding "--registrar:legacy" to the build command line prevents the crash.
Comment 1 John Miller [MSFT] 2014-09-03 16:42:08 UTC
Created attachment 7906 [details]
test Case
Comment 2 Sebastien Pouliot 2014-09-04 08:43:27 UTC
@Rolf, I thought that was fixed, ref "New class, old one now inherits new one". Maybe it regressed ?
Comment 3 Rolf Bjarne Kvinge [MSFT] 2014-09-04 14:05:22 UTC
I haven't been able to make the test project detect my bluetooth LE device, no matter what I do (I modified the sample to scan for all uuids, not just one specific).

John, can you attach the full stack trace, maybe that'll tell me something useful instead.
Comment 4 Sebastien Pouliot 2014-09-04 14:06:57 UTC
IIRC PKObject (for PassKit) was another of the "new" base classes introduced in iOS8.
Comment 5 Marco Lancione 2014-09-04 14:08:51 UTC
Here is the full stack trace:

2014-09-02 10:16:53.212 BluetoothTest[241:60b] Unhandled managed exception: Wrapper type 'MonoTouch.CoreBluetooth.CBPeer' is missing its native ObjectiveC class 'CBPeer'. (MonoTouch.RuntimeException)
  at MonoTouch.Registrar.DynamicRegistrar.OnRegisterType (MonoTouch.Registrar.ObjCType type) [0x00339] in /Developer/MonoTouch/Source/maccore/src/ObjCRuntime/DynamicRegistrar.cs:582 
  at MonoTouch.Registrar.Registrar.RegisterTypeUnsafe (System.Type type, System.Collections.Generic.List`1& exceptions) [0x00af2] in /Developer/MonoTouch/Source/maccore/src/ObjCRuntime/Registrar.cs:1264 
  at MonoTouch.Registrar.Registrar.RegisterTypeUnsafe (System.Type type, System.Collections.Generic.List`1& exceptions) [0x00052] in /Developer/MonoTouch/Source/maccore/src/ObjCRuntime/Registrar.cs:974 
  at MonoTouch.Registrar.Registrar.RegisterType (System.Type type) [0x0002e] in /Developer/MonoTouch/Source/maccore/src/ObjCRuntime/Registrar.cs:876 
  at MonoTouch.Registrar.DynamicRegistrar.Lookup (IntPtr class, Boolean throw_on_error) [0x00041] in /Developer/MonoTouch/Source/maccore/src/ObjCRuntime/DynamicRegistrar.cs:676 
  at MonoTouch.ObjCRuntime.Class.Lookup (IntPtr klass, Boolean throw_on_error) [0x00000] in /Developer/MonoTouch/Source/maccore/src/ObjCRuntime/Class.cs:101 
  at MonoTouch.ObjCRuntime.Class.Lookup (IntPtr klass) [0x00000] in <filename unknown>:0 
  at MonoTouch.ObjCRuntime.Runtime.GetNSObject (IntPtr ptr, System.Type target_type, MissingCtorResolution missingCtorResolution, Boolean evenInFinalizerQueue, System.Boolean& created) [0x0002d] in /Developer/MonoTouch/Source/maccore/src/ObjCRuntime/Runtime.iOS.cs:565 
  at MonoTouch.ObjCRuntime.Runtime.GetNSObjectWrapped (IntPtr ptr, IntPtr type_ptr, System.Boolean& created) [0x0000c] in /Developer/MonoTouch/Source/maccore/src/ObjCRuntime/Runtime.iOS.cs:758 
  at (wrapper native-to-managed) MonoTouch.ObjCRuntime.Runtime:GetNSObjectWrapped (intptr,intptr,int&)
  at (wrapper managed-to-native) MonoTouch.UIKit.UIApplication:UIApplicationMain (int,string[],intptr,intptr)
  at MonoTouch.UIKit.UIApplication.Main (System.String[] args, IntPtr principal, IntPtr delegate) [0x00005] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIApplication.cs:62 
  at MonoTouch.UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x0001c] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIApplication.cs:45
Comment 6 Rolf Bjarne Kvinge [MSFT] 2014-09-04 16:08:54 UTC
Fixed.

monotouch/ios8-7.4.0: 1b405b1b2a7bda6ad73fbbc4362d616e855252f3
maccore/ios8-7.4.0: b89f1097054a4a4a762d0bbc79d695c5c71d0026