Xamarin.Forms First-Aid for Errors

In this post, I'll show you how to fix the codesign error with warning "Warning: unable to build chain to self-signed root for signer <Developer from certificate here (ID of certificate)" /directory/to/your/mobile.app: errSecInternalComponent.

Background info

You've set up the certificates and profiles for your Xamarin.Forms iOS project properly.

To be sure, you let Xcode do all the signing with automatic provisioning activated.

You hit the compile button, and *KABOOM* you get the following codesign error 🙅🏻‍♂️:

/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/iOS/Xamarin.iOS.Common.targets(3,3): Error: Failed to codesign 'bin/iPhone/Debug/device-builds/iphone10.4–15.3/Your.iOS.app': Warning: unable to build chain to self-signed root for signer "Apple Development: Your Name (XXXXX)" /Users/yourusername/Projects/yourapp/Src/AppName/AppName.iOS/bin/iPhone/Debug/device-builds/iphone10.4–15.3/AppName.iOS.app: errSecInternalComponent

The errSecInternalComponent might seem to give us a lead about what's going on, but Googling around shoots you all kinds of directions.

I was trying to build my project, so I could run it on my iPhone device, and the error kept hitting me. Even repeating all the cleaning and restarting my solution didn't bring me the desired outcome.

Fixing the codesign error

Here's how I fixed the error:

  1. I checked my profile stuff, and that I was logged into my Apple account from Visual Studio -> Preferences -> Accounts
  2. let Visual Studio do the signing for me enabling the "Automatic Provisioning" that you can find & setup via left-click Info.Plist -> Application tab
  3. To make sure my keychain login chain wasn't locked, I ran the following in my Terminal: $ security unlock-keychain login.keychain (followed by entering my computer password in the dialogue that appears)
  4. I restarted my MacBook Pro
  5. After restart, I removed the USB cable from my phone to my MacBook, and re-inserted it
  6. I cleaned my entire solution
  7. Then I ran the project to build and compile it for my device

After these steps (and only after these steps) I got served a dialogue by Visual Studio stating that Visual Studio wanted to access my developer certificate information from my Keychain.

I entered my password and watched how the build continued to succeed.

Hopefully this fix also helps you to fix the error “Warning: unable to build chain to self-signed root for signer <Developer from certificate here (ID of certificate)” /directory/to/your/mobile.app: errSecInternalComponent. Just one of those rare errors you can get while busy on cross-platform mobile app development using the xamarin and xamarin.forms framework for your c# based mobile app project

To Conclude

This took me well over an hour to find out, and it never happened after that. Using a platform like Xamarin(.Forms) and Visual Studio makes building multi-platform mobile applications a really nice experience.

Just note that when you're using any cross-platform solution you need to keep into account the added layer of dependencies (on top of the Apple- and Android OS, tooling and configuration), which can make it a little more confusing when an error lands on your screen.

I hope this info and the steps provided by me help you to save some time.

Take care, like if you like, and let me know how this worked out for you.

And remember:

Create. Value. First