C# try catch block doesn't work for iOS?

Trying to build an app to iOS, & to my surprise it seems code in a standard C# try-catch block hangs the build. Does try-catch work in an iOS build? I hope I can post code here properly (first time), but the offending code is:

try {
    		xmlDoc.LoadXml(xmlDocString);
    		try {
    			steering = float.Parse(xmlDoc.DocumentElement.Attributes["steering"].Value);
    		} catch {
    			steering = 0f;
    		}
} catch {
}

It hangs on the inner try catch block. I nested the try-catch blocks to isolate the problem. xmlDoc is an XmlDocument object that loads an XML string sent via a SendMessage (so the string is cast from type object). I understand an exception may occur because the XML string may not contain the attribute. But isn’t try-catch supposed to handle this kind of exception handling? Does Android build have the same issue?

Any info welcome & appreciated. Thanks.

Do you have exception handling enabled? If you want to catch exceptions on iOS you should make sure that the exception handling has been enabled (from Project Settings → Player Settings → iOS → Other Settings set “Script Call Optimization” to “Slow and Safe”).

It should work. But you can’t really figure out the problem if you don’t know what it is. Change your catch methods to this

catch(Exception e){
     Debug.log(e.toString());
}

That will help you isolate the problem, it’s probably something really simple but you won’t know unto you see what the errors are