Obscure issues for Xamarin iOS

I offer you a collection of fixes for some of the more obscure issues that I’ve encountered during my experience with Xamarin.iOS. This is the result of hours of head scratching and searching for solutions on Stack Overflow and Xamarin Forums.

Failed to compile the generated registrar code.

This can happen if you are targeting an older SDK and use code that require a newer version. Open up properties for your iOS project, go to iOS Build and set SDK version to Default. This will select the latest SDK.

extra linker definition file could not be located

If you have added a linker xml file to point to assemblies that needs to be linked, you need to make sure that this file’s Copy to Output Directory property is set to Copy if newer to make sure it is copied over.

An error occured on client Build420680 while executing a reply for topic

I think there can be several reasons for this bug, but for me it was that I have moved away from xcassets as icons, but the reference was still in my .csproj file. Search for xcassets and remove the entire itemgroup.

Failed to read file attributes for “/Users/**/Library/Caches/Xamarin/Resources/Images.xcassets”

Similar as the last issue. For this I had to delete the image.xcassets from the folder, and even had to delete "/Library/Caches/Xamarin/mtbs/builds/[App_Name]" folder on my Mac.

Native linking error, not found or no such file ….

Add namespace to your linker xml file. Remember to add extra argument to mtouch argument: --xml=${ProjectDir}/linker.xml

    <assembly fullname="{your namespace}">
        <type fullname="{your namespace}.*" />

For a more detailed look: MTouch errors.

view missing default constructor.

I got this mysterious bug after adding a storyboard, but deselecting "use size classes" did the trick for me.

Could not AOT the assembly ‘/Users/**/Library/Caches/Xamarin/mtbs/builds/**/…

This was a bug in one of the Xamarin builds, after an update to the latest build it went away.

Could not load Info.plist: Could not find file “/Users/**/Library/Caches/Xamarin/mtbs/builds/**

Check the properties for the info.plist. Build action should have been set to None and Copy as newer.

error MT1206: Could not find the simulator runtime ‘com.apple.CoreSimulator.SimRuntime.iOS-“*’

This means that you are missing the simulator for the version that you are running against. Open up XCode -> Preferences -> Components and download the simulator that you need.

General issues

If all else fails I try these steps:

  • delete bin and obj folders
  • delete packages folder
  • delete components folder
  • restore nuget packages and components
  • cross my fingers and hope for the best