Bug 13017 - System.Linq.Enumerable.ToArray exception
Summary: System.Linq.Enumerable.ToArray exception
Alias: None
Product: iOS
Classification: Xamarin
Component: Xamarin.iOS.dll ()
Version: 6.3.x
Hardware: PC Windows
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
Depends on:
Reported: 2013-07-02 13:31 UTC by cristoph
Modified: 2013-12-05 18:34 UTC (History)
3 users (show)

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

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:

Description cristoph 2013-07-02 13:31:51 UTC
I have a Dictionary<object,int> _table instance and when I do only on iOS 5.1 and Xamarin.iOS 6.3.x following:
object[] deadKeys = this._table.Keys.Where(a=> !((MyObject)a).IsAlive).ToArray();
it throws following exception:

System.NullReferenceException: Object reference not set to an instance of an object
2013-07-02 09:02:11.402 SiaqodbTest[6298:707] System.NullReferenceException: Object reference not set to an instance of an object
  at System.String.memcpy4 (System.Byte* dest, System.Byte* src, Int32 size) [0x00042] in /Developer/MonoTouch/Source/mono/mcs/class/corlib/System/String.cs:2998 
  at System.String.memcpy (System.Byte* dest, System.Byte* src, Int32 size) [0x0008e] in /Developer/MonoTouch/Source/mono/mcs/class/corlib/System/String.cs:3081 
  at System.Collections.Generic.Dictionary`2+KeyCollection+Enumerator[System.Object,System.Int32].get_Current () [0x00000] in /Developer/MonoTouch/Source/mono/mcs/class/corlib/System.Collections.Generic/Dictionary.cs:1086 
  at (wrapper unknown) object:gsharedvt_in ()
  at System.Linq.Enumerable+<CreateWhereIterator>c__Iterator29`1[System.Object].MoveNext () [0x00000] in <filename unknown>:0 
  at System.Linq.Enumerable.ToArray[Object] (IEnumerable`1 source) [0x00000] in <filename unknown>:0
Comment 1 Sebastien Pouliot 2013-07-02 13:42:51 UTC
We'll require a bit more information. E.g.

* when you said "only on iOS 5.1" do you mean it works on other iOS versions ?

* what's your exact version number ? [1]

* can you provide a test case so we can duplicate the issue ? [2]


[1] The easiest way to get exact version information is to use the "Xamarin Studio" menu, "About Xamarin Studio" item, "Show Details" button and copy/paste the version informations (you can use the "Copy Information" button). 

[2] Such issues often varies with the type being used. Not knowing that MyObject looks like can make it impossible to duplicate the issue. A self-contained test case ensure we can get, and fix, the exact issue you're having (without guesswork).
Comment 2 Pierre-Andre van Leeuwen 2013-07-03 01:54:46 UTC
I'm the one that reported this to siaqodb. Here is my Xamarin Studio version info:

=== Xamarin Studio ===

Version 4.0.9 (build 12)
Installation UUID: 1030e9f0-93cd-48b3-b8c4-1969d101e68b
	Mono 3.0.12 ((no/d6c5db8)
	GTK 2.24.18
	GTK# (
	Package version: 300120000

=== Apple Developer Tools ===

Xcode 4.6.3 (2068)
Build 4H1503

=== Xamarin.iOS ===

Version: (Business Edition)
Hash: fa63be7
Build date: 2013-17-06 20:54:24-0400

=== Xamarin.Android ===

Version: 4.7.9 (Starter Edition)
Android SDK: /Users/pierreandre/Library/Developer/Xamarin/android-sdk-mac_x86
	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)
Java SDK: /usr
java version "1.6.0_45"
Java(TM) SE Runtime Environment (build 1.6.0_45-b06-451-11M4406)
Java HotSpot(TM) 64-Bit Server VM (build 20.45-b01-451, mixed mode)

=== Xamarin.Mac ===

Xamarin.Mac: Not Installed

=== Build Information ===

Release ID: 400090012
Git revision: f9c5c24e88417feb0319953db6d5fc650d416608
Build date: 2013-06-21 17:34:16+0000
Xamarin addins: 898d8afaabb160c025e21656f1490fa149397bff

=== Operating System ===

Mac OS X 10.8.4
Darwin tanto 12.4.0 Darwin Kernel Version 12.4.0
    Wed May  1 17:57:12 PDT 2013
    root:xnu-2050.24.15~1/RELEASE_X86_64 x86_64
Comment 3 Sebastien Pouliot 2013-07-05 09:42:09 UTC
Thanks but that only answered one (of the three) questions I had. The most important one was the last, a test case so we can reproduce the issue.

Many fixes were part of 6.3.7 (released this week), including a fix for something that produced a very similar stack trace.

You might want to try it and let us know if it's already fixed. Otherwise we'll need the test case to fix this.
Comment 4 PJ 2013-11-19 17:04:34 UTC
This bug has been in the NEEDINFO state with no changes for the last 90 days. Can we put this back into the NEW or CONFIRMED state, or are we still awaiting response?

If there is no change in the status of this bug over the next two weeks, this bug will be marked as NORESPONSE.
Comment 5 PJ 2013-12-05 18:34:40 UTC
This bug has not been changed from the NEEDINFO state since my previous comment, marking as RESOLVED NORESPONSE.

Please feel free to REOPEN this bug at any time if you are still experiencing the issue. Please add the requested information and set the bug back to the NEW (or CONFIRMED) state.