Xamarin UI Tests often fail to run after a successful run

So I've been messing with the Xamarin UI tests and found that they can sometimes fail for the simple reason the simulator likes to be reset each time. For some reason it'll fail over with the error message:

Could not find key: com.apple.MobileInstallation.BundleCodeInfoIdentifier

I've added this to our build scripts before each build:

killall "Simulator"
xcrun simctl erase all

The first line kills the simulator, this will be different on different versions of XCode. The second line then tells all simulators to erase themselves. If you were only testing on a single platform then I'd recommend using xcrun simctl list and pushign that into grep to find the uuid if the device you wish to clean each time.