See the included archive.
When building the same library and running the "appTest" in Visual Studio for mac 7.4 - no runtime errors.
The following runtime exception occurs in Visual Studio for mac 7.5 preview:
ObjCRuntime.RuntimeException
Failed to compute the token reference for the type 'MyLibrary.IMyDelegate, MyLibrary, Version=1.0.6662.22178, Culture=neutral, PublicKeyToken=null' because the assembly couldn't be found in the list of registered assemblies.
Visual Studio for Mac: === Visual Studio Community 2017 for Mac (Preview) ===
Version 7.5 Preview (7.5 build 933)
Installation UUID: fc7abb7e-06dc-4098-adf5-e2bc57251ad4
Runtime:
Mono 5.10.0.179 (2017-12/dac60775616) (64-bit)
GTK+ 2.24.23 (Raleigh theme)
Xamarin.Mac 4.4.0.36 (master / 0c7c49a6)
=== NuGet ===
Version: 4.3.1.4445
=== .NET Core ===
Runtime Versions:
2.0.5
2.0.0
SDK Versions:
2.1.4
2.0.0
MSBuild SDKs: /Library/Frameworks/Mono.framework/Versions/5.10.0/lib/mono/msbuild/15.0/bin/Sdks
=== Xamarin.Android ===
Version: 8.3.0.5 (Visual Studio Community)
Android SDK: /Users/alexander.gribov/Library/Developer/Xamarin/android-sdk-macosx
Supported Android versions:
6.0 (API level 23)
7.0 (API level 24)
7.1 (API level 25)
8.0 (API level 26)
SDK Tools Version: 25.2.5
SDK Platform Tools Version: 25.0.3
SDK Build Tools Version: 26.0.1
Java SDK: /usr
java version "1.8.0_92"
Java(TM) SE Runtime Environment (build 1.8.0_92-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.92-b14, mixed mode)
Android Designer EPL code available here:
https://github.com/xamarin/AndroidDesigner.EPL
=== Apple Developer Tools ===
Xcode 9.2 (13772)
Build 9C40b
=== Xamarin.Mac ===
Version: 4.4.0.31 (Visual Studio Community)
=== Xamarin.iOS ===
Version: 11.10.0.32 (Visual Studio Community)
Hash: 4d8c4e32
Branch: d15-7
Build date: 2018-03-07 18:39:46-0500
=== Build Information ===
Release ID: 705000933
Git revision: ace1e107c88477db1abe5e807809650f064112c4
Build date: 2018-03-19 17:42:41-04
Xamarin addins: a01263bdbba2589b1f6e42ef085bd31f6e3bfcf4
Build lane: monodevelop-lion-d15-7
=== Operating System ===
Mac OS X 10.13.3
Darwin 17.4.0 Darwin Kernel Version 17.4.0
Sun Dec 17 09:19:54 PST 2017
root:xnu-4570.41.2~1/RELEASE_X86_64 x86_64
@GribovAlexander
I'm not able to reproduce the error you mentioned using those versions of Xamarin.iOS + VSMac. When I build and deploy to my iOS device, it's successful with no runtime errors. Are there additional steps I need to take?
Note: I had to remove/re-add the native reference in the MyLibrary project to resolve a build error in the apptest project.
I have recorded a screencast to illustrate how to reproduce the issue using the provided sample project
A follow-up. I have found that the error is specific to the Simulator - I have no issues when running the same application on a real iPhone.
Thanks @GribovAlexander! I was able to reproduce the issue now.
This will be fixed in our d15-8 release (which is still several months away).
In the meantime, the workaround is to add --registrar:static as an additional mtouch argument in the project's iOS Build options. The downside is that the build will be slightly slower (it's otherwise
safe: in fact it's the default option for device builds, which is why the problem only occur in the simulator).
@rolfbjarne why is this pushed so far into the release schedule? Adding --registrar:static gives a heap of other problems with other libraries that don't seem to like this on simulator builds. (Don't know why this isn't a problem on device builds yet.)
So for us this is a blocking issue, how can we pull this forward?
@Qonstrukt the previous release (d15-7) was just about to be released (in fact it was released yesterday), which is why the fix will be in the next release. We might be able to get it into a service release if it turns out important enough, but first I'd like to investigate why --registrar:static causes problems for simulator builds and see if those can be fixed. Can you get a diagnostic build log for both a (broken) simulator and a (working) device build and attach them here?
We have the same problem and this is a showstopper problem. We cannot wait months for this to be resolved.
@gahms does adding --registrar:static to the additional mtouch arguments in the project's iOS Build options work for you? If not, could you please attach both a (working) device build log and a (broken) simulator build log?
I was able to pin my problems to a package with (unwanted) dependencies on MetalKit which causes the build process to start spewing messages about MTKView not being defined. I've fixed it now by removing the package, but I'll attach a non-working build-log when I have time.
This is blocking for us as well, please prioritize.
Also, this has broken a project of ours which was building fine earlier. I'm on the latest VS version (7.5 for Mac, build 1254).
We can't build the project with --registrar:static as then linking fails because of "duplicate symbols" (we are using Xamarin's GoogleMobileAds lib which is complaining now):
MTOUCH: Error MT5213: Duplicate symbol in: /Users/{PROJECT_PATH}/obj/iPhoneSimulator/Debug/mtouch-cache/GoogleMobileAds(flat-x86_64) (Location related to previous error) (MT5213)
@rolfbjarne Adding --registrar:static resolves it. Where do I find the build logs?
@gahms See https://docs.microsoft.com/en-us/xamarin/android/troubleshooting/troubleshooting#diagnostic-msbuild-output for how to get build logs, but if --registrar:static works for you, there's no need to provide them.
@zengable can you attach the complete (diagnostic) build log?
Third-party NuGet packages like Xamarin's Google wrappers are causing build failures with this issue (on both simulator and device). Anyone know where I can find the previous release of VS Mac (7.4)? No way of finding it on either Xamarin or Microsoft's site.
@markerpen this issue should not happen for device builds, it may be that you're running into something else. Could you please file a new issue and attach your build logs so that we can have a look?
The previous stable version of Xamarin.iOS was v11.9.1.24 (package) - you can just download and install that package. There should be no need to downgrade Visual Studio for Mac.
@rolfbjarne as @markerpen and me have commented earlier, the --registrar:static is not a proper solution to this, as third party libs, like Xamarin's Google nugets cannot be linked after introducing this build flag.
I am linking to the requested log. As mentioned, this only happens after setting the MTOUCH flag:
https://www.dropbox.com/s/sxetcmequ2ohkjt/static_registrar_linking_fail.rtf?dl=0
If the flag is not there, the build is successful, but we get "Failed to compute the token reference for the type" for our Google Analytics Tracker object.
With the Xamarin.iOS v11.9.1.24, none of the above happens.
@zengable I can reproduce the problem with the Google NuGets, I'll see if I can do something about that.
ok great
Surely this shouldn't wait for a couple of months to be released!
I've wasted an 2 hours of my time trying to figure out what was wrong before Googling my way to this page...
Anyone using the Google Analytics package in their app and running on a simulator will encounter this issue. That's got to be a lot of people.
@rolfbjarne After installing latest upgrades, my iOS project won't work on simulator or real device... in short... I cannot do anything :(
This is the error on real device (on simulator is the same as above)
clang: Error: linker command failed with exit code 1 (use -v to see invocation)
MTOUCH: Error MT5211: Native linking failed, undefined Objective-C class: MBProgressHUDDelegate. The symbol '_OBJC_CLASS_$_MBProgressHUDDelegate' could not be found in any of the libraries or frameworks linked with your application. (MT5211)
MTOUCH: Error MT5202: Native linking failed. Please review the build log. (MT5202) (FishAngler.iOS)
This is my build output
build-output.txt
This is my environment description
my-environment.txt
@claudioredi where do you get MBProgressHUD.dll from? Most likely it will need to be rebuilt.
@rolfbjarne : will check about that. On simulator I'm having the same issue as pointed above. Thanks
@zengable I've found and fixed the problem in the Google Nugets, and a new version will hopefully be out tomorrow.
Also started having this issue yesterday for another dev and me this morning after some updates on the MAC. Thanks @rolfbjarne for the workaround.
Ran into the same issue today. The workaround works for us, thanks.
@rolfbjarne Doesn't work for me - started getting the following errors:
clang : error : linker command failed with exit code 1 (use -v to see invocation)
MTOUCH : error MT5211: Native linking failed, undefined Objective-C class: FBFriendPickerDelegate. The symbol '_OBJC_CLASS_$_FBFriendPickerDelegate' could not be found in any of the libraries or frameworks linked with your application.
MTOUCH : error MT5211: Native linking failed, undefined Objective-C class: FBGraphObjectPickerDelegate. The symbol '_OBJC_CLASS_$_FBGraphObjectPickerDelegate' could not be found in any of the libraries or frameworks linked with your application.
MTOUCH : error MT5211: Native linking failed, undefined Objective-C class: FBLoginTooltipViewDelegate. The symbol '_OBJC_CLASS_$_FBLoginTooltipViewDelegate' could not be found in any of the libraries or frameworks linked with your application.
MTOUCH : error MT5211: Native linking failed, undefined Objective-C class: FBLoginViewDelegate. The symbol '_OBJC_CLASS_$_FBLoginViewDelegate' could not be found in any of the libraries or frameworks linked with your application.
MTOUCH : error MT5211: Native linking failed, undefined Objective-C class: FBPlacePickerDelegate. The symbol '_OBJC_CLASS_$_FBPlacePickerDelegate' could not be found in any of the libraries or frameworks linked with your application.
MTOUCH : error MT5211: Native linking failed, undefined Objective-C class: FBRequestConnectionDelegate. The symbol '_OBJC_CLASS_$_FBRequestConnectionDelegate' could not be found in any of the libraries or frameworks linked with your application.
MTOUCH : error MT5211: Native linking failed, undefined Objective-C class: FBUserSettingsDelegate. The symbol '_OBJC_CLASS_$_FBUserSettingsDelegate' could not be found in any of the libraries or frameworks linked with your application.
MTOUCH : error MT5211: Native linking failed, undefined Objective-C class: FBViewControllerDelegate. The symbol '_OBJC_CLASS_$_FBViewControllerDelegate' could not be found in any of the libraries or frameworks linked with your application.
MTOUCH : error MT5211: Native linking failed, undefined Objective-C class: FBWebDialogsDelegate. The symbol '_OBJC_CLASS_$_FBWebDialogsDelegate' could not be found in any of the libraries or frameworks linked with your application.
MTOUCH : error MT5202: Native linking failed. Please review the build log.
Hey @rolfbjarne, thanks for working on fixing this. Do you know when it will be available to download on stable channel?
@claudioredi it will take a few months for the fix to reach the stable channel, but the workaround should work fine for you in the meantime.
This error occurs with https://github.com/xamarin/FacebookComponents/ for iOS as well, the workaround fixes the issue for now... Thanks.
@desunit are you using the Xamarin Facebook Components binding?
+1, having the same issue with Xamarin.SDWebImage.
Failed to compute the token reference for the type 'SDWebImage.ISDWebImageOperation, SDWebImage, Version=3.7.0.0, Culture=neutral, PublicKeyToken=null' because the assembly couldn't be found in the list of registered assemblies
Updating this package to 4.0 beta does not help
Adding
<MtouchLink>SdkOnly</MtouchLink>
for Debug iPhoneSimulator does a trick for me
Is there any news on a workaround reaching stable for this?
@wickedw
Is there any news on a workaround reaching stable for this?
It's been in the stable channel for a while now. If you still see this error, please file a new issue and we'll have a look.
Thanks @rolfbarne I just never knew it was there, I will clear my workarounds and report back if any issues.
Most helpful comment
This will be fixed in our d15-8 release (which is still several months away).
In the meantime, the workaround is to add
--registrar:staticas an additional mtouch argument in the project's iOS Build options. The downside is that the build will be slightly slower (it's otherwisesafe: in fact it's the default option for device builds, which is why the problem only occur in the simulator).