Error while loading assemblies: /bin/iPhoneSimulator/Debug/libHarfBuzzSharp.dll - visual-studio

Error while loading assemblies: /Users/admin/Library/Caches/Xamarin/mtbs/builds/project.iOS/6b01e66516e8420be8424059207235df/bin/iPhoneSimulator/Debug/libHarfBuzzSharp.dll.
I had recently upgraded my packages in xamarin iOS project and also visual studio to 16.7.4 version .Now I'm unable to build the iOS Project . Earlier it was building fine and able to deploy to a simulator.
I had delected bin, obj and rebuild the solution but the error still persists.
Please help me to figure out the root cause of this error.

Related

failed to resolve ObjCRuntime.TrampolineBlockBase

I am implementing google Admob in my Xamarin.Forms application. My android project is working perfectly but my iOS project fails to build. when I build the project it shows
Failed to resolve "ObjCRuntime.TrampolineBlockBase" reference from "Xamarin.iOS, Version=0.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065"
and it also say I am missing few files.
I tried to download the mobile sdk framework for ios from https://developers.google.com/admob/ios/quick-start#cocoapods and then add to the project but I can't seem to add this framework to references.
Any kind of help is really helpful.
I had this issue on App Center. Resolved by upgrading SDK and Xcode versions in build configuration options
I was able to resolve the issue from upgrading the visual studio 2019 to 16.4.5 and downgrading the Xamarin.Firebase.iOS.AdMob from 7.47.0.1 to 7.27.0.3
After doing that I restarted Visual Studio and build the project it successfully built.
Also, I referred to this link for help
Edit:
In short, Visual studio installed the new appropriate mono framework for ios which basically solved the issue here.
In case anyone else runs into this issue, I got this issue after adding the Maps sdk to iOS. I had to upgrade Xamarin.iOS from 13.6.0.12 to 13.10.0.21 to resolve the issue.

Xamarin: Try to run the Project. I'm new bee for xamarin and want to run my xamarin ios project

I want to run the xamarin ios project and maybe its native code for ios xamarin.
I install visual studio for mac and open the project, then add missing packages.
But in One package Zxing.Mobile I get the error (I can't find relative package) So I comment related code and try to run the project. So I get the few errors and here I attached that snap
So please help me I'm iOS native developer and want to run this xamarin project.
This error generally occurs when a dependency of your nuget package is having an issue and can't be linked. You can try installing the dependency nuget package manually and that should resolve it.

Getting Unknown Build error in Visual Studio for Mac

While trying to build a Xamarin.ios project, it gives me Unknown Build Error, for iPhone Device.
While Building for Simulator it builds fine.
The Error i get is somrthing like below.
Error: /Users/admin/Documents/projectdirectory/AppName.app: unknown error -1=ffffffffffffffff
I am using latest Xamarin and Xcode, and MVVM crosslight.
Please help in resolving.
The issue was with certificate. The app was not able to build properly as it wasn't able to find the certificate.
the issue got resolved by just restarting the machine.

Xamarin.iOS app will not build to device but does build to simulator; Realm issue?

I get the following build error when targeting an iOS device:
MTOUCH : error MT2101: Can't resolve the reference 'System.Void* System.Runtime.CompilerServices.Unsafe::AsPointer(!!0&)', referenced from the method 'T Realms.MarshaledVector`1::MarshalElement(System.Int32)' in 'System.Runtime.CompilerServices.Unsafe, Version=4.0.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
Specifically I think the reference is made here: T Realms.MarshaledVector
This builds fine on the simulator but it fails when targeting the device. The Realm NuGet Package is installed. In fact I just removed it and re-installed it to see if that might fix it; it didn't.
Anyone know anything else to try to make this run or what could cause this build error only when the target is a device?
iOS version: 11.2.1 (15C153)
OSX version: 10.13.2
Visual Studio Community Version: 7.3.2 (build 12)
Xcode: 9.2 (9C40b)
... later ...
Ok it appears like it's definitely realm. Even the act of doing this:
using Realms;
var settingsFilename = "/some/path/settings.realm";
var Config = new RealmConfiguration(settingsFilename);
Causes Visual Studio Community to fail to build the project with the error mentioned above. I have this code in my AppDelegate FinishedLaunching.
Next up I'm gonna try and strip everything away in there and see what happens I guess.
... later ...
Ok the reference error is different now at least.
MTOUCH : error MT2101: Can't resolve the reference 'System.Void* System.Runtime.CompilerServices.Unsafe::AsPointer(!!0&)', referenced from the method 'T Realms.MarshaledVector1::MarshalElement(System.Int32)' in 'System.Runtime.CompilerServices.Unsafe, Version=4.0.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
Error processing method: 'T Realms.MarshaledVector1::MarshalElement(System.Int32)' in assembly: 'Realm.dll'
Failed to resolve System.Void* System.Runtime.CompilerServices.Unsafe::AsPointer(!!0&)
It specifically calls out: in assembly: 'Realm.dll'
So at least for now what I did, after this ate my entire day leaving me with 0 progress. I started a new project, installed the same dependencies
Realm (2.1.0)
Serilog (2.6.0)
Serilog.Sinks.Xamarin (0.1.29)
System.Reactive (3.1.1)
Xam.Plugin.Connectivity (3.0.3)
Xamarin.Auth (1.5.0.3)
No Error.
So I went back to my customer's project, deleted all the packages from packages.config and re-installed them all. It doesn't seem to have this build error any longer (Can't resolve the reference 'System.Void* ...).
It occasionally seems to fail to deploy to the device properly under debug scenarios with the following error:
dyld: Library not loaded: #rpath/libmonosgen-2.0.dylib
But cleaning the project and trying again, seems to fix it. Also I can turn off Incremental Builds under:
Project Settings -> Build -> iOS Build -> Enable Incremental Builds
And that will also get past he dyld loading issue.
Per this other questions, Visual Studio Community missing developer tools for iOS 11.2.1, cannot debug, a commenter also recommends just unloading the project from the solution and reloading it to solve the problem as well.
So I'm going to count my blessing and just keep going until it blows up again. I should note this did happen AFTER I upgraded Visual Studio Community in the middle of this project to: 7.3.2 (build 12). Again, it only seemed to happen when trying to debug on a device, in this case an iPhone X running iOS 11.2.1 (15C153). I have yet to try on other devices/os versions yet, since again, this literally consumed my whole day yesterday.
Same error with Realm 2.0.0.
How i fixed it :
Installed the NuGet package System.Runtime.CompilerServices.Unsafe
Removed the System.Runtime.CompilerServices.Unsafe lib in project
references
Re-add the lib manually by selecting the file System.Runtime.CompilerServices.Unsafe.dll located in packages folder
project. (the one installed in step 1)
Hope it'll help !

Xamarin and Xcode update to iOS 10 and "Got a SIGABRT while executing native code..."

Following my upgrade of Xamarin and Xcode to the iOS 10 updates/releases my app began failing on launch. The app never even entered the App.cs constructor for me to begin debugging.
Actual Error Message: "Got a SIGABRT while executing native code. This usually indicates a fatal error in the mono runtime or one of the native libraries used by your application."
After spending many hours trying to solve this problem I finally got a clue from digging through the iOS Simulator logs.
Detailed Error message:
Loaded assembly:
/Users/username/Library/Developer/CoreSimulator/Devices/BC0B1376-DDDF-4DD1-954D-1872603FA8E6/data/Containers/Bundle/Application/2AA663A3-986B-434E-83B9-E7D88A6616FE/VSProjectName.app/.monotouch-64/System.ComponentModel.DataAnnotations.dll
An unhandled exception occured.
2016-09-16 23:12:13.570 VSProjectName[5278:156681] Unhandled
Exception: System.BadImageFormatException: Could not load file or
assembly or one of its dependencies. Reference assemblies should not
be loaded for execution. They can only be loaded in the
Reflection-only loader context.
File name: 'System.ComponentModel.DataAnnotations' 2016-09-16
23:12:13.570 VSProjectName[5278:156681] Unhandled managed exception:
Could not load assembly
Answer
In one of my shared class library projects, referenced by the Xamarin.iOS project, I had a reference to the .NET 4.5 version of the System.ComponentModel.DataAnnotations.dll assembly, even though there was no code anywhere in either of these projects that was using this assembly.
The app kept crashing on launch because, this version of the System.ComponentModel.DataAnnotations.dll assembly cannot run on a mobile platform.
Removing System.ComponentModel.DataAnnotations from the list of references in the class library project solved the problem.
Please note that, prior to me upgrading to Xcode Version 8.0 (8A218a) and Xamarin 4.2.0.680 for Visual studio, this code worked fine.

Resources