Bug 26516 - CTFontManager.RegisterFonts always throws ArgumentNullException
Summary: CTFontManager.RegisterFonts always throws ArgumentNullException
Status: RESOLVED FIXED
Alias: None
Product: iOS
Classification: Xamarin
Component: Xamarin.iOS.dll ()
Version: XI 8.6.0
Hardware: Macintosh Mac OS
: Normal normal
Target Milestone: Untriaged
Assignee: Rolf Bjarne Kvinge [MSFT]
URL:
Depends on:
Blocks:
 
Reported: 2015-01-28 15:43 UTC by Peter Golde
Modified: 2015-01-29 08:12 UTC (History)
3 users (show)

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


Attachments
Sample Xamarin project (30.13 KB, application/zip)
2015-01-28 15:43 UTC, Peter Golde
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 Peter Golde 2015-01-28 15:43:24 UTC
Created attachment 9541 [details]
Sample Xamarin project

I'm having problems calling the CTFontManager.RegisterFontsForUrl api. From the stack trace, the problem appears to be in the Monotouch/Xamarin.iOS wrappers.

when I call this API, I always get an exception inside the RegisterFontsForUrl call:

System.ArgumentNullException: Argument cannot be null. Parameter name: domain at MonoTouch.Foundation.NSError..ctor (MonoTouch.Foundation.NSString domain, Int32 code, MonoTouch.Foundation.NSDictionary userInfo) [0x00017] in /Developer/MonoTouch/Source/monotouch/src/build/compat/Foundation/NSError.g.cs:74 at MonoTouch.Foundation.NSError..ctor (MonoTouch.Foundation.NSString domain, Int32 code) [0x00000] in /Developer/MonoTouch/Source/maccore/src/Foundation/NSError.cs:55 at MonoTouch.CoreText.CTFontManager.RegisterFontsForUrl (MonoTouch.Foundation.NSUrl fontUrl, CTFontManagerScope scope) [0x00011] in /Developer/MonoTouch/Source/maccore/src/CoreText/CTFontManager.cs:84 at RegisterFontsTest.RegisterFontsTestViewController.ViewDidLoad () [0x00027] in /Users/petergolde/Projects/RegisterFontsTest/RegisterFontsTest/RegisterFontsTestViewController.cs:34 at 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) [0x00038] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIApplication.cs:46 at RegisterFontsTest.Application.Main (System.String[] args) [0x00008] in /Users/petergolde/Projects/RegisterFontsTest/RegisterFontsTest/Main.cs:17

This appears to be from the Monotouch libraries making an incorrect call to the NSError constructor.

I've reproduced the problem in both the classic and unified API, and both the emulator and a device (all on iOS 8).

I'm attaching a sample application. Although I realize there are simpler ways to use a single custom font, my specific application requires this API to deal with arbitrary font files.
Comment 1 Shruti 2015-01-29 01:52:20 UTC
I have checked this issue with attached Project and observed that "CTFontManager.RegisterFontsForUrl" api is throwing System.ArgumentNullException.

Screencast : http://www.screencast.com/t/PWEpoKhpwkc7
Application Output : https://gist.github.com/Shruti360/4254c8284e7daf1bb7bc
Build Log : https://gist.github.com/Shruti360/4510aa0428e26cc115ee
IDE Log : https://gist.github.com/Shruti360/8bba45dd5f1ad0a9a481

Environment Info:
=== Xamarin Studio ===

Version 5.7.1 (build 15)
Installation UUID: 67eaf3b4-f8a7-4ab4-a9df-3197350ca5dc
Runtime:
	Mono 3.12.0 ((detached/a813491)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 312000068

=== Apple Developer Tools ===

Xcode 6.2 (6758)
Build 6C107a

=== Xamarin.iOS ===

Version: 8.6.1.20 (Enterprise Edition)
Hash: 3b3ef43
Branch: 
Build date: 2015-01-24 09:42:21-0500

=== Xamarin.Android ===

Version: 4.20.0.28 (Enterprise Edition)
Android SDK: /Users/ixamarin78/Desktop/android-sdk-macosx
	Supported Android versions:
		2.1    (API level 7)
		2.2    (API level 8)
		2.3    (API level 10)
		3.1    (API level 12)
		4.0    (API level 14)
		4.0.3  (API level 15)
		4.1    (API level 16)
		4.2    (API level 17)
		4.3    (API level 18)
		4.4    (API level 19)
		4.4.87 (API level 20)
		5.0    (API level 21)
Java SDK: /usr
java version "1.8.0_25"
Java(TM) SE Runtime Environment (build 1.8.0_25-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode)

=== Xamarin.Mac ===

Version: 1.12.0.4 (Enterprise Edition)

=== Build Information ===

Release ID: 507010015
Git revision: ce24e991948c7f3d88b0194a14fc1996d848ef51
Build date: 2015-01-26 16:42:20-05
Xamarin addins: 6895e3222bfa6910524708aa0633ff3db99bc3a0

=== Operating System ===

Mac OS X 10.10.0
Darwin XamnewiMac.local 14.0.0 Darwin Kernel Version 14.0.0
    Fri Sep 19 00:26:44 PDT 2014
    root:xnu-2782.1.97~2/RELEASE_X86_64 x86_64
Comment 2 Rolf Bjarne Kvinge [MSFT] 2015-01-29 07:24:54 UTC
Looks like our bindings are not correct.
Comment 3 Rolf Bjarne Kvinge [MSFT] 2015-01-29 08:12:11 UTC
Fixed.

maccore/master: fdeac575ecc6409abfb5f57dc8380d1157805582