The issue is due to the way that MonoTouch compiles to native iPhone binaries. It does not support JIT compilation, which a "normal" .NET environment does support. In most cases this is fine, but sometimes the compiler cannot fully detect the types that are needed and therefore doesn't compile them into the binary. Then, during runtime, when it detects it needs a type that was not compiled it crashes.
The code below is a pretty simple example of this issue:
/// <summary>Initializes a new instance of the <see cref="Shape"/> class.</summary>/// <param name="points">The points.</param>public Shape(Vector2d[] points): this(points.Select(point => new Vector2((float)point.X, (float)point.Y)).ToArray()){}
This is a very simple alternate constructor for my
So, why doesn't this work? Well, the error I get is something like:
Attempting to JIT compile method 'System.Linq.Enumerable/PredicateOf`1<OpenTK.Vector2d>:.cctor ()' while running with --aot-only.
I believe what this is saying is that the constructor for
/// <summary>Initializes a new instance of the <see cref="Shape"/> class.</summary>
/// <param name="points">The points.</param>
public Shape(Vector2d[] points)
: this(new List<Vector2d>(points).Select(point => new Vector2((float)point.X, (float)point.Y)).ToArray())
{
}
In this case, the LINQ expression is over the
I need to play around with this a bit more to see how I can fix it without the
Next time: Phunky Physics.
No comments:
Post a Comment