Bug 22109 - Static compilation problem with ImmutableCollections
Summary: Static compilation problem with ImmutableCollections
Status: RESOLVED FIXED
Alias: None
Product: iOS
Classification: Xamarin
Component: XI runtime ()
Version: master
Hardware: PC Mac OS
: Normal normal
Target Milestone: Untriaged
Assignee: Zoltan Varga
URL:
Depends on:
Blocks:
 
Reported: 2014-08-14 10:05 UTC by Miguel de Icaza [MSFT]
Modified: 2014-08-14 15:57 UTC (History)
1 user (show)

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


Attachments
Sample program showing the problem (213.41 KB, application/octet-stream)
2014-08-14 10:05 UTC, Miguel de Icaza [MSFT]
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 Miguel de Icaza [MSFT] 2014-08-14 10:05:45 UTC
Created attachment 7691 [details]
Sample program showing the problem

When using Microsoft's Immutable Collections with MonoTouch, when running on device we get this error.

This only happens if the List is made up of reference types, if the list is made up of value types, it works.

var list = new List<string>();
list.Add("one");
list.Add("two");

foreach (var item in list.ToImmutableList())
    System.Diagnostics.Debug.WriteLine(item);
}

Fails with this error:

System.ExecutionEngineException: Attempting to JIT compile method 'System.Collections.Immutable.SecurePooledObject`1<System.Collections.Generic.Stack`1<System.Collections.Immutable.RefAsValueType`1<System.Collections.Immutable.IBinaryTree`1<string>>>>:ThrowDisposedIfNotOwned<System.Collections.Immutable.ImmutableList`1/Enumerator<string>> (System.Collections.Immutable.ImmutableList`1/Enumerator<string>)' while running with --aot-only. See http://docs.xamarin.com/ios/about/limitations for more information.

  at System.Collections.Immutable.ImmutableList`1+Enumerator[System.String].ThrowIfDisposed () [0x00000] in <filename unknown>:0
  at System.Collections.Immutable.ImmutableList`1+Enumerator[System.String].Reset () [0x00000] in <filename unknown>:0
  at System.Collections.Immutable.ImmutableList`1+Enumerator[System.String]..ctor (IBinaryTree`1 root, System.Collections.Immutable.Builder builder, Int32 startIndex, Int32 count, Boolean reversed) [0x00000] in <filename unknown>:0
  at System.Collections.Immutable.ImmutableList`1[System.String].GetEnumerator () [0x00000] in <filename unknown>:0
  at testImmutableGenerics.AppDelegate.FinishedLaunching (MonoTouch.UIKit.UIApplication app, MonoTouch.Foundation.NSDictionary options) [0x00046] in /Users/miguel/Projects/testImmutableGenerics/testImmutableGenerics/AppDelegate.cs:31
  at at (wrapper managed-to-native) MonoTouch.UIKit.UIApplication:UIApplicationMain (int,string[],intptr,intptr)
  at MonoTouch.UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x0004c] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIApplication.cs:39
  at testImmutableGenerics.Application.Main (System.String[] args) [0x00008] in /Users/miguel/Projects/testImmutableGenerics/testImmutableGenerics/Main.cs:17

Attached is a sample
Comment 1 Zoltan Varga 2014-08-14 15:57:23 UTC
Fixed in mono master 407b8163c8fc1c806c306920daf0a2b543d1a400 and bumped mt master to it in acfbea8c22f7558f44135353b810cc0db1c25fc5.