I’ve come across what I think is an interesting bug in iOS 5.0 (this code works perfectly in 5.1). After ages of narrowing it down using lots of Console.Write()’s, I narrowed the crash to:
nsUrl.ToString();
This is either in the MonoTouch library or iOS.
Anybody else come across this? It’s annoying, as we obviously want to support the minimum iOS version possible.
In MonoTouch the default
ToStringimplementation, forNSObjectsubclasses, is to call thedescriptionselector.In some cases (and yes it varies with iOS versions) calling
descriptioncan fail (or even crash the process). That generally occurs when the native object is a bad state (e.g. mis-initialized, invalid value…).MonoTouch tries to handle such cases (when possible and known) by using a different
ToStringimplementation (e.g. with extra checks or by falling back to the defaultToString, which returns the type name).Note: If you find such behaviour please report them in bug reports and we’ll see if they can be handled differently.