Hello, > In my project, I use many generic classes, most of them nested, like > this: List<KeyValuePair<List<T1>, List<T2>>. When i create too many > instances of these generic classes (with different type parameters), i > get the exception: > > Unhandled exception of type System.ExecutionEngineException: > Attempting to JIT compile method > 'System.Collections.Generic.List`1<System.Collections.Generic.KeyValuePair`2<string, > System.Collections.Generic.List`1<string>>>:.ctor ()' while running > with --aot-only. > > This only happens when running on iPhone device, on the Simulator > everything is fine. > Is there a parameter for aot compilation that can affect the maximum > number of generic instances? (I already use > -aot="nimt-trampolines=2048")
This is not a problem of a limit in the number of generic instances. The iPhone does not support dynamic code generation, so all of the possible instantiations of the code must be determine at compile time. In some scenarios, it is not possible for the static compiler to determine which instantiations you will use, and this is what the above error is showing. This is because your code is dynamically trying to create a List<string> but the AOT engine had no way of knowing this would be the case. You can work around this by having somewhere in your code this: var x = new List<string> () Which will assist the AOT compiler in determining that this is necessary Miguel _______________________________________________ MonoTouch mailing list [email protected] http://lists.ximian.com/mailman/listinfo/monotouch
