after 2 Weeks of Developement i first tried my app on the iphone and it crashes at the following line (which works perfectly in the simulator):
i have the following code:
private readonly Dictionary<string, QueueItem queued = new Dictionary<string, QueueItem>();
private void Processqueue()
{
KeyValuePair<string, QueueItem> valuePair = queued.FirstOrDefault();
// Crashes with: System.TypeInitializationException has been thrown
// "And exception was thrown by the type initializer for PredicateOf`1"
}
private class QueueItem
{
public string Url { get; set; }
public Action<string> ImageLoaded { get; set; }
public bool Pending { get; set; }
}
Hope that someone has an idea what to do.
thanks
Somehow the AOT compiler could not detect this case so yes you should file a bug report about it. In the mean time you can workaround this by doing:
which will avoid reaching PredicateOf while doing the exact same thing (execution wise) and a bit shorter than looping yourself.
Also you got a TypeLoadException because the original exception occurred in a static constructor (which always results in a TLE, the inner exception should be the one you expected to see).
UPDATE: This was filed as bug #300 and fixed in recent releases of MonoTouch (4.2+)