Bug 33324

Summary: Casting List to IList causes argument exception on device build in Add method.
Product: iOS Reporter: INs <insider83>
Component: Mono runtime / AOT compilerAssignee: Zoltan Varga <vargaz>
Severity: normal CC: kumpera, masafa, mono-bugs+monotouch
Priority: ---    
Version: XI 8.10   
Target Milestone: Untriaged   
Hardware: Macintosh   
OS: Mac OS   
Tags: Is this bug a regression?: ---
Last known good build:

Description INs 2015-08-24 08:08:24 UTC
Code like following:

var list = new List<double?> ();
 var l = (IList)list;
 l.Add (1.0);
 l.Add (null);

Raises the exception when running on device, but under simulator works fine. Found that issue when tried to deserialize a list of nullable doubles using Json.NET.

Actual Results:

Argument exception is raised.

Expected Results:

Should work without exceptions.

How often does this happen? 

Additional Information:

System.ArgumentNullException: Argument cannot be null.\nParameter name: item\n  at System.ThrowHelper.ThrowArgumentNullException (ExceptionArgument argument) [0x00000] in /Users/builder/data/lanes/1977/2c66d2fe/source/mono/external/referencesource/mscorlib/system/throwhelper.cs:82 \n  at System.ThrowHelper.IfNullAndNullsAreIllegalThenThrow[Nullable1] (System.Object value, ExceptionArgument argName) [0x00019] in /Users/builder/data/lanes/1977/2c66d2fe/source/mono/external/referencesource/mscorlib/system/throwhelper.cs:121 \n at (wrapper unknown) object:gsharedvt_in ()\n at (wrapper unknown) object:gsharedvt_out ()\n at System.Collections.Generic.List1[System.Nullable1[System.Double]].System.Collections.IList.Add (System.Object item) [0x00000] in /Users/builder/data/lanes/1977/2c66d2fe/source/mono/external/referencesource/mscorlib/system/collections/generic/list.cs:256 \n`
Comment 1 Zoltan Varga 2015-08-27 16:34:22 UTC
Fixed by mono master d60aec02dca1e3ee15f21672675c2c275199b67a. The fix will be in an upcoming xamarin.ios release.
Comment 2 Zoltan Varga 2015-08-27 16:35:42 UTC
maccore master 3f2249d3d7ca48ab2131fda856d6f691b3c0ca4d is the mono bump which contains the fix.