I'm writing an iPad app that uses pre-existing C# libraries to drive the
logic (which is why we are using MonoTouch). On the simulator all is well,
but on the device a use of LINQ for objects is causing a JIT crash.
I've looked at the MonoTouch limitations, and I can understand how certain
uses of generics can hide function calls from the linker, but I'm not
sophisticated enough to know why the following crashes:
// ActivitiesItem in this test is a very simple object with two int
properties, ID and Slope, which
// are set by the constructor
List<ActivitiesItem> Items = new List<ActivitiesItem>();
Items.Add(new ActivitiesItem(1, 1));
Items.Add(new ActivitiesItem(2, 2));
Items.Add(new ActivitiesItem(3, 3));
// ItemResponse is another simple object with two int properties, ItemId and
Choice, and
// one bool property, IsSkippedBool, which are set via the constructor.
List<ItemResponse> _responses = new List<ItemResponse>();
_responses.Add(new ItemResponse(1, 10, true));
_responses.Add(new ItemResponse(3, 20, false));
IEnumerable<EnteredItem> responseItems = from r in _responses
join i in Items on r.ItemId equals i.ID
where r.IsSkippedBool == false
select new EnteredItem(i.Slope, r.Choice);
int count = responseItems.Count();
The program crashes on the invocation of the last line, but in the debugger
that line causes execution to jump to the "join" line in the LINQ statement.
Stepping through, I reach the accessor for ActivitiesItem.ID, then after
clicking that I get:
Attempting to JIT compile method 'System.Linq.Enumerable:
<ToLookup`2>m__13<TestGeneric.ActivitiesItem, int>
(TestGeneric.ActivitiesItem)' while running with --aot-only
If LINQ doesn't work in MonoTouch, I'm going to be a fairly unhappy man this
afternoon...
bjs
--
Brian Schuth
ALPHCE, Inc.
Eastport, ME
+1 207 370 2430
[email protected]
_______________________________________________
MonoTouch mailing list
[email protected]
http://lists.ximian.com/mailman/listinfo/monotouch