Xamarin.iOS app crashing with error DYLD Library not loaded, mapped file has no cdhash, Code has to be at least ad-hoc signed

Hello. I am using Windows VS 2019 paired to my Mac. My Xamarin.iOS app has started crashing with this error in the Xcode device logs: DYLD Library not loaded mapped file has no cdhash, Code has to be at least ad-hoc signed.

I have not made changes to the app. Visual Studio reports that the app deployed successfully on the iPhone and it starts to open then crashes.

I have uninstalled and reinstalled all of my Apple certificates in Keychain and made sure the trust setting is set to Use System Defaults. I have upgraded Xcode to 12.5 and Visual Studio to 16.10.1. Has anyone encountered and fixed this? Please help!

The immediate cause of this error is very clear: Some part of your program is not signed and thus iOS refuses to load it. As to how things got that way, it’s hard to say given that you’re using a wealth of third-party tooling. My advice is that your escalate this via the support channel for that tooling.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Are you saying that the app is not getting signed because of Visual Studio?

Not necessarily. I’m saying that:

  • Your setup is heavily tied to third-party tooling.

  • I, personally, have no experience with that tooling.

  • You’re unlikely to find folks who have such experience here on DevForums, where the focus is Apple APIs and tools.

  • You’re more likely to find help via the support channel for that third-party tooling.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Can you help me to understand what the third-party tooloing has to do with signing?

Because the third-party tool is creating the project that you’re asking Xcode to sign. Specifically, this message:

DYLD Library not loaded mapped file has no cdhash

means that the code simply wasn’t signed. If you were working with a normal Xcode project you’d never get into this situation.

I thought this would be more of a problem with my Apple Developer certificates, identifiers, and profiles or something with my certificates in Keychain Access.

That’s unlikely given the above error message, but it’s also easy to rule out so let’s do that now. Using Xcode, create a new project from the iOS > App template with the same team and bundle ID as your real app. Can you build and run that?

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

I opened a technical support ticket with my Visual Studio account.

In working with them they found a bug in Visual Studio. They found that the issue is entirely around the incremental build option. This seems to be broken in Visual Studio 2019 on Windows when deploying to a iPhone connected to the Mac. They could reproduce the exact error in a template project just by enabling incremental builds.

Apparently incremental builds work by creating that lib.exe.dylib dynamic library to allow building and loading just the changes so the bug seems to be that the generated incremental library is not being signed correctly.

When I disable incremental builds I am able to deploy my app to the iPhone and debug it and a bug report has been submited to fix the issue.

Xamarin.iOS app crashing with error DYLD Library not loaded, mapped file has no cdhash, Code has to be at least ad-hoc signed
 
 
Q