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 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 13143 [details]
Simple Classic API app reproducing the exception
Running the following code on iOS 7.1 crashes with the parameter "UIFontWeight.Bold". See the attached solution.
UILabel lbl = new UILabel(View.Bounds);
lbl.Text = "Hello world";
lbl.Font = UIFont.SystemFontOfSize(16, UIFontWeight.Bold);
"MonoTouch.Foundation.MonoTouchException: Objective-C exception thrown. Name: NSInvalidArgumentException Reason: +[UIFont systemFontOfSize:weight:]: unrecognized selector sent to class 0x8a5d5f4"
Leaving "UIFontWeight.Bold" out and just setting the font-size to 16 works fine.
Using the following version info:
Xamarin 3.11.837.0 (f10676f)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.
Xamarin.Android 126.96.36.199 (f98871a95a479f6d71b3067b7e5834d41fcb2118)
Visual Studio plugin to enable development for Xamarin.Android.
Xamarin.iOS 188.8.131.52 (6db87c53c073f4af2f5247fb738a27ea08c094fd)
Visual Studio extension to enable development for Xamarin.iOS.
Xamarin.iOS Unified Migration 1.0
Automated migration for Xamarin iOS Classic projects to Unified
That's because you're running this on an old version of iOS and this specific API was added in iOS 8.2 and is decorated with `[iOS (8,2)]`.
The IDE (at least XS* does) should show a hint that the API requires iOS 8.2. It's then up to you to decide if you want to do a version check (before using the API) or use an older API (available in all versions of iOS you wish to support).
* moving to VS for verification
Thanks for your quick reply. I'm not sure what you mean with 'HINT', but VS2013 doesn't show any hint or warning.
However, I pressed F12 (Go to definition) and in the metadata source file I found the attribute:
public static UIFont SystemFontOfSize(nfloat size, UIFontWeight weight);
I didn't know this existed, but I do now.
I created a quick work-around for now.
Again, thanks for the advice.
Created attachment 13148 [details]
@Eric, I rarely use Windows (even less VS) but I assume XVS does something similar to XS to give "hints" about API availability (see screenshot).
The XVS team will be able to tell you if/how it's done.
@eric: please let me know if you still need help with this. Otherwise I will mark it as resolved. Thanks, Adrian
Marking as resolved. Please let us know if you still need help with this issue. Thanks, Adrian