Bug 34380 - Native type size mismatch between Xamarin.iOS.dll and the executing architecture. Xamarin.iOS.dll was built for 64-bit, while the current process is 32-bit.
Summary: Native type size mismatch between Xamarin.iOS.dll and the executing architect...
Alias: None
Product: Visual Studio Extensions
Classification: Xamarin
Component: iOS ()
Version: unspecified
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2015-09-29 04:37 UTC by andreas.nesheim
Modified: 2016-12-22 23:07 UTC (History)
6 users (show)

Is this bug a regression?: ---
Last known good build:

Build log after Alpha update (39.37 KB, text/plain)
2015-10-09 06:04 UTC, andreas.nesheim

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description andreas.nesheim 2015-09-29 04:37:48 UTC
I'm using Xamarin in Visual Studio to debug an iOS application. I'm using a Macbook Pro (2011 edition) with Intel Core i5  and OS X Yosemite as a build and debugging server. When I try to debug the iOS application on the iPhone simulator on the Macbook Pro, the application instantly breaks and Visual Studio gives me the error: An unhandled exception occured. In the Output window of Visual Studio the following message appears: Native type size mismatch between Xamarin.iOS.dll and the executing architecture. Xamarin.iOS.dll was built for 64-bit, while the current process is 32-bit.

The app in question has recently been upgraded to Unified API.
Comment 1 Rolf Bjarne Kvinge [MSFT] 2015-09-29 04:46:27 UTC
Does the same thing happen if you build & run your project using Xamarin Studio on your Mac?
Comment 2 andreas.nesheim 2015-09-30 01:58:40 UTC
No, I get another error there. I fixed up some errors and now the mentioned error is gone. However, the app in question also uses MvvmCross and now I'm getting the following error: 

Failed to resolve "System.Boolean Cirrious.MvvmCross.ViewModels.MvxNavigatingObject::ShowViewModel(System.Object,Cirrious.MvvmCross.ViewModels.MvxBundle,Cirrious.MvvmCross.ViewModels.MvxRequestedBy)" reference from "Cirrious.MvvmCross, Version=, Culture=neutral, PublicKeyToken=e16445fd9b451819"
Comment 3 Rolf Bjarne Kvinge [MSFT] 2015-09-30 06:54:11 UTC
That sounds like you're using an old version of a third-party assembly or component/nuget.

Can you enable diagnostic MSBuild [1] output in Xamarin Studio and attach the full build log?

[1] https://developer.xamarin.com/guides/android/troubleshooting/troubleshooting/
Comment 4 andreas.nesheim 2015-10-06 08:45:01 UTC
I've updated the components now, but I am still wondering why I am recieving the error when trying to debug from Visual Studio on Windows.
Comment 5 Rolf Bjarne Kvinge [MSFT] 2015-10-06 08:50:04 UTC
@Andreas, the initial error or the error from comment #2? In any case a full build log might help us diagnose it.
Comment 6 andreas.nesheim 2015-10-06 09:18:58 UTC
The output from Debug:

Loaded assembly: /Users/Capgemini/Library/Developer/CoreSimulator/Devices/4DA4851F-38EA-4771-8B5C-F49B4801A30B/data/Containers/Bundle/Application/84D31131-1C04-4984-8A2E-4993334C3B65/SolvbergetiOS.app/Xamarin.iOS.dll [External]
2015-10-06 15:17:51.494 SolvbergetiOS[4341:86113] Native type size mismatch between Xamarin.iOS.dll and the executing architecture. Xamarin.iOS.dll was built for 64-bit, while the current process is 32-bit.
An unhandled exception occured.

2015-10-06 15:17:55.662 SolvbergetiOS[4341:86113] Unhandled managed exception:
Native type size mismatch between Xamarin.iOS.dll and the executing architecture. Xamarin.iOS.dll was built for 64-bit, while the current process is 32-bit. (ObjCRuntime.RuntimeException)
  at ObjCRuntime.Runtime.Initialize (ObjCRuntime.InitializationOptions& options) [0x000a8] in <filename unknown>:0 
2015-10-06 15:17:55.663 SolvbergetiOS[4341:86113] critical: Stacktrace:

2015-10-06 15:17:55.664 SolvbergetiOS[4341:86113] critical: 
Native stacktrace:

2015-10-06 15:17:55.667 SolvbergetiOS[4341:86113] critical: 	0   SolvbergetiOS                       0x00201897 mono_handle_native_sigsegv + 311
2015-10-06 15:17:55.667 SolvbergetiOS[4341:86113] critical: 	1   SolvbergetiOS                       0x002082d1 sigabrt_signal_handler + 145
2015-10-06 15:17:55.667 SolvbergetiOS[4341:86113] critical: 	2   libsystem_platform.dylib            0x0849403b _sigtramp + 43
2015-10-06 15:17:55.668 SolvbergetiOS[4341:86113] critical: 	3   ???                                 0xffffffff 0x0 + 4294967295
2015-10-06 15:17:55.668 SolvbergetiOS[4341:86113] critical: 	4   libsystem_sim_c.dylib               0x0822ca5a abort + 156
2015-10-06 15:17:55.669 SolvbergetiOS[4341:86113] critical: 	5   SolvbergetiOS                       0x00385ef6 xamarin_unhandled_exception_handler + 342
2015-10-06 15:17:55.669 SolvbergetiOS[4341:86113] 
critical: 	6   SolvbergetiOS                       0x002020eb mono_invoke_unhandled_exception_hook + 91
2015-10-06 15:17:55.670 SolvbergetiOS[4341:86113] critical: 	7   SolvbergetiOS                       0x00200fce mono_handle_exception_internal + 6206
2015-10-06 15:17:55.670 SolvbergetiOS[4341:86113] critical: 	8   SolvbergetiOS                       0x001ff789 mono_handle_exception + 41
2015-10-06 15:17:55.670 SolvbergetiOS[4341:86113] critical: 	9   SolvbergetiOS                       0x0019b437 mono_x86_throw_exception + 135
2015-10-06 15:17:55.671 SolvbergetiOS[4341:86113] critical: 	10  ???                                 0x143fcf57 0x0 + 339726167
2015-10-06 15:17:55.671 SolvbergetiOS[4341:86113] critical: 	11  ???                                 0x14444424 0x0 + 340018212
2015-10-06 15:17:55.671 SolvbergetiOS[4341:86113] critical: 	12  SolvbergetiOS                       0x0022f19b mono_jit_runtime_invoke + 715
2015-10-06 15:17:55.672 SolvbergetiOS[4341:86113] critical: 	13  SolvbergetiOS                       0x002c5aaf mono_runtime_invoke + 127
2015-10-06 15:17:55.672 SolvbergetiOS[4341:86113] critical: 	14  SolvbergetiOS                       0x00386450 xamarin_initialize + 912
2015-10-06 15:17:55.672 SolvbergetiOS[4341:86113] critical: 	15  SolvbergetiOS                       0x0039ed4d xamarin_main + 2061
2015-10-06 15:17:55.673 SolvbergetiOS[4341:86113] critical: 	16  SolvbergetiOS                       0x00156971 main + 113
2015-10-06 15:17:55.673 SolvbergetiOS[4341:86113] critical: 	17  libdyld.dylib                  
     0x08188ac9 start + 1
2015-10-06 15:17:55.674 SolvbergetiOS[4341:86113] critical: 	18  ???                                 0x00000003 0x0 + 3
2015-10-06 15:17:55.674 SolvbergetiOS[4341:86113] critical: 
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.

Output from Build (not much info here):

1>------ Build started: Project: Solvberget.iOS, Configuration: Debug iPhoneSimulator ------
1>  Restoring NuGet packages...
1>  To prevent NuGet from downloading packages during build, open the Visual Studio Options dialog, click on the Package Manager node and uncheck 'Allow NuGet to download missing packages'.
1>  All packages listed in packages.config are already installed.
1>  Generated session id: a8aed9195fcbb7fba36c550f73db557f
1>  Generated build app name: SolvbergetiOS
1>C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(498,3): warning : The iOS SDK version '8.4' is not installed. Using newer version '9.0' instead'.
1>  Solvberget.iOS -> C:\workspace\Solvberget\src\Solvberget\Solvberget.iOS\bin\iPhoneSimulator\Debug\SolvbergetiOS.exe
========== Build: 1 succeeded, 0 failed, 3 up-to-date, 0 skipped ==========
========== Deploy: 0 succeeded, 0 failed, 0 skipped ==========
Comment 7 Rolf Bjarne Kvinge [MSFT] 2015-10-06 09:34:45 UTC
Try cleaning the project before building, otherwise it won't build anything and the log shows up empty.
Comment 8 andreas.nesheim 2015-10-07 02:03:28 UTC
Tried cleaning the project too, same output.
Comment 9 Rolf Bjarne Kvinge [MSFT] 2015-10-07 09:04:10 UTC
@Andreas, did you enable diagnostic MSBuild output as described here: https://developer.xamarin.com/guides/android/troubleshooting/troubleshooting/?
Comment 10 andreas.nesheim 2015-10-09 03:21:15 UTC
I've done this now. Should I copy the output here or send it to you as a file?
Comment 11 Rolf Bjarne Kvinge [MSFT] 2015-10-09 03:27:57 UTC
Please attach it as a file here.
Comment 13 Rolf Bjarne Kvinge [MSFT] 2015-10-09 03:55:54 UTC
This looks like a problem in the VS plugin, for some reason this ends up being passed to mtouch on the mac:

> -r "C:/Program Files (x86)/Reference Assemblies/Microsoft/Framework/Xamarin.iOS/v1.0/Xamarin.iOS.dll"

which is obviously wrong, since that's a Windows path, not a Mac path.
Comment 14 andreas.nesheim 2015-10-09 06:03:33 UTC
I tried updating from Alpha channel on both my Windows machine and my Mac build host. My previous error disappeared, but was substituted by new errors. Attaching a file with the debug log here.
Comment 15 andreas.nesheim 2015-10-09 06:04:01 UTC
Created attachment 13254 [details]
Build log after Alpha update
Comment 16 poelzlbauer 2015-11-10 06:10:09 UTC
We also run into this problem when trying to recompile a xamarin app (not xamarin forms app) for ios 9.1. We also have the same result (no build) when trying to build on max with xamarin studio.

Ist there any progress yet?
Comment 17 Jose Gallardo 2016-12-22 23:07:32 UTC
As we've added several improvements to our build system and deploying/debugging mechanism since the bug was reported, I'm resolving it tentatively as Fixed.
That said, if you're still facing this issue with current bits, please feel free to reopen the bug.