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.
Created attachment 13837 [details]
## Steps to reproduce
1. Download and run attached project on iOS 8, or 9, simulator
Note that there is no crash
2. Run the project again on iOS 7
The app crashes
## Expected result
## Actual result
App crashes as UIInputSetContainerView is not available in iOS 7 and thus is passing null to the isKindOfClass call.
In Objective-C, you would expect that when nil is passed NO (false) is returned.
Test run: https://testcloud.xamarin.com/test/testiskindofclass_f4119bf9-3820-498a-b576-c4d4828d2a5c/
=== Xamarin Studio ===
Version 5.10 (build 871)
Installation UUID: 11a26d86-0d21-407a-8da9-8c197ecc0ad1
Mono 4.2.1 (explicit/6dd2d0d)
GTK+ 2.24.23 (Raleigh theme)
Package version: 402010102
=== Xamarin.Profiler ===
=== Xamarin.Android ===
Version: 188.8.131.52 (Business Edition)
Android SDK: /Users/Adam/Library/Developer/Xamarin/android-sdk-macosx
Supported Android versions:
4.0.3 (API level 15)
4.4 (API level 19)
5.0 (API level 21)
SDK Tools Version: 24.3.4
SDK Platform Tools Version: 23.0.1
SDK Build Tools Version: 23.0.1
Java SDK: /usr
java version "1.7.0_71"
Java(TM) SE Runtime Environment (build 1.7.0_71-b14)
Java HotSpot(TM) 64-Bit Server VM (build 24.71-b01, mixed mode)
=== Xamarin Android Player ===
Location: /Applications/Xamarin Android Player.app
=== Apple Developer Tools ===
Xcode 7.1.1 (9081)
=== Xamarin.Mac ===
Version: 184.108.40.206 (Business Edition)
=== Xamarin.iOS ===
Version: 220.127.116.11 (Business Edition)
Build date: 2015-11-12 13:05:39-0500
=== Build Information ===
Release ID: 510000871
Git revision: 4e9c5abb5ffdae12ba02ac49da83f8b2011dbb88
Build date: 2015-11-12 06:02:54-05
Xamarin addins: 55007ed0e56436f385d8e26394a45be563abc7e8
Build lane: monodevelop-lion-cycle6
=== Operating System ===
Mac OS X 10.11.1
Darwin Adams-Retina-MacBook-Pro.local 15.0.0 Darwin Kernel Version 15.0.0
Sat Sep 19 15:53:46 PDT 2015
I do not think there's a crash, but you'll get an exception (and if you don't catch it the app will crash).
`isKindOfClass` is part of the NSObject protocol, not the type and is not documented to allow `null`. IOW it might not always work on ObjC depending on the code that answers the selector.
That's the reason why we have a null check and throw a, catchable, exception instead of a (usually fatal) runtime crash.
OTOH I think it's not a very common situation so we'll likely allow null in future versions of XI.
Lots of native apps are using IsKindOfClass with the same possible nil test (like in my case https://github.com/TransitApp/SVProgressHUD/commit/23e0dd2d9aba1a0ff6d71c46103b5816b1e1de65).
According to NSObject doc, there is effectively no explicit indication that nil is supported. But from my understanding:
YES if the receiver is an instance of aClass or an instance of any class that inherits from aClass, otherwise NO.
means that anything else (like nil) than the current class (or a derived class) must return NO.
>IOW it might not always work on ObjC depending on
the code that answers the selector.
If you refer to the class cluster case, I can understand the issue but I think it is not the Xamarin.iOS binding to ensure the API is properly used by the programmer...
Fixed in maccore/master 8e30cf68801cf87cf3ba02987217a44909f5158f
QA: unit tests added in same commit
Undocumented but every NSObject subclasses from Apple allow null for NSObject protocol members parameters. Tests were added so we'll know if that change in the future.