Bug 51299 - UTType.GetDescription throws ArgumentNullException
Summary: UTType.GetDescription throws ArgumentNullException
Alias: None
Product: Xamarin.Mac
Classification: Desktop
Component: Library (Xamarin.Mac.dll) (show other bugs)
Version: 2.10.0 (C8)
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2017-01-09 11:46 UTC by juanjo.a
Modified: 2017-01-09 19:02 UTC (History)
2 users (show)

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


Description juanjo.a 2017-01-09 11:46:59 UTC
UTType.GetDescription(string uti) in Mobilecoreservices

throws ArgumentNullException when the argument is not null, and does not throw the exception when the argument is null.

Looking at the Xamarin source code /src/MobileCoreServices/UTType.cs

public string GetDescription (string uti)
			if (uti != null)
				throw new ArgumentNullException ("uti");

			var a = NSString.CreateNative (uti);
			var ret = NSString.FromHandle (UTTypeCopyDescription (a));
			NSString.ReleaseNative (a);
			return ret;

It should be 
if (uti == null)
Comment 1 Chris Hamons 2017-01-09 14:59:37 UTC
Woops. You are correct.
Comment 2 Chris Hamons 2017-01-09 15:02:57 UTC
Comment 3 Chris Hamons 2017-01-09 19:02:25 UTC
Fixed in master and cycle9.

Thanks for the report. This will be fixed in the next major release.

Note You need to log in before you can comment on or make changes to this bug.