Bug 31258 - App crashes using Link SDK Assemblies Only when built from Visual Studio Only (Works in Xamarin Studio)
Summary: App crashes using Link SDK Assemblies Only when built from Visual Studio Only...
Status: RESOLVED DUPLICATE of bug 31379
Alias: None
Product: Visual Studio Extensions
Classification: Xamarin
Component: iOS ()
Version: 3.11 (C5)
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2015-06-19 14:48 UTC by Jon Goldberger [MSFT]
Modified: 2015-06-25 13:58 UTC (History)
4 users (show)

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

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:
Status:
RESOLVED DUPLICATE of bug 31379

Description Jon Goldberger [MSFT] 2015-06-19 14:48:24 UTC
## Description

App crashes on Launch Screen when using Link SDK Assemblies Only linker option when app is built from Visual Studio. App does not crash with same settings in Xamarin Studio or with the Don't Link linker option in either IDE.

Error in debug output when crash occurs:

>2015-06-19 08:39:27.217 ComputersUnlimitedMedicalDeliveryAppiOS[18713:15766969] Unhandled managed exception:
>Could not load file or assembly 'System.Net.Primitives' or one of its dependencies. The system cannot find the file specified. (System.IO.FileNotFoundException)
>  at System.AppDomain.Load (System.Reflection.AssemblyName assemblyRef, System.Security.Policy.Evidence assemblySecurity) [0x00081] in /Users/builder/data/lanes/1503/e6ebd18b/source/mono/mcs/class/corlib/System/AppDomain.cs:706 
>  at System.AppDomain.Load (System.Reflection.AssemblyName assemblyRef) [0x00000] in /Users/builder/data/lanes/1503/e6ebd18b/source/mono/mcs/class/corlib/System/AppDomain.cs:674 
>  at System.Reflection.Assembly.Load (System.Reflection.AssemblyName assemblyRef) [0x00000] in /Users/builder/data/lanes/1503/e6ebd18b/source/mono/mcs/class/corlib/System.Reflection/Assembly.cs:551 
>  at ObjCRuntime.Runtime.CollectReferencedAssemblies (System.Collections.Generic.List`1 assemblies, System.Reflection.Assembly assembly) [0x00019] 
>in /Users/builder/data/lanes/1503/e6ebd18b/source/maccore/src/ObjCRuntime/Runtime.cs:218 
>  at ObjCRuntime.Runtime.CollectReferencedAssemblies (System.Collections.Generic.List`1 assemblies, System.Reflection.Assembly assembly) [0x0002c] in /Users/builder/data/lanes/1503/e6ebd18b/source/maccore/src/ObjCRuntime/Runtime.cs:220 
>  at ObjCRuntime.Runtime.CollectReferencedAssemblies (System.Collections.Generic.List`1 assemblies, System.Reflection.Assembly assembly) [0x0002c] in /Users/builder/data/lanes/1503/e6ebd18b/source/maccore/src/ObjCRuntime/Runtime.cs:220 
>  at ObjCRuntime.Runtime.RegisterEntryAssembly (System.Reflection.Assembly entry_assembly) [0x0001b] in /Users/builder/data/lanes/1503/e6ebd18b/source/maccore/src/ObjCRuntime/Runtime.cs:200 
>  at ObjCRuntime.Runtime.RegisterEntryAssembly (IntPtr a) [0x00000] in /Users/builder/data/lanes/1503/e6ebd18b/source/maccore/src/ObjCRuntime/Runtime.cs:158 
>  at ObjCRuntime.Runtime.register_entry_assembly (IntPtr assembly) [0x00000] in /Users/builder/data/lanes/1503/
>e6ebd18b/source/maccore/runtime/Delegates.generated.cs:118 
>  at (wrapper native-to-managed) ObjCRuntime.Runtime:register_entry_assembly (intptr)
>2015-06-19 08:39:27.218 ComputersUnlimitedMedicalDeliveryAppiOS[18713:15766969] critical: Stacktrace:
>
>2015-06-19 08:39:27.218 ComputersUnlimitedMedicalDeliveryAppiOS[18713:15766969] critical: 
>Native stacktrace:
>2015-06-19 08:39:27.361 ComputersUnlimitedMedicalDeliveryAppiOS[18713:15766969] critical: 	0   ComputersUnlimitedMedicalDeliveryAppiOS 0x0040b177 mono_handle_native_sigsegv + 311
>2015-06-19 08:39:27.361 ComputersUnlimitedMedicalDeliveryAppiOS[18713:15766969] critical: 	1   ComputersUnlimitedMedicalDeliveryAppiOS 0x00411ec1 sigabrt_signal_handler + 129
>2015-06-19 08:39:27.362 ComputersUnlimitedMedicalDeliveryAppiOS[18713:15766969] critical: 	2   libsystem_platform.dylib            0x0429b03b _sigtramp + 43
>2015-06-19 08:39:27.362 ComputersUnlimitedMedicalDeliveryAppiOS[18713:15766969] critical: 	3   ???                                 0xffffffff 0x0 + 4294967295
>2015-06-19 08:39:27.362 ComputersUnlimitedMedicalDeliveryAppiOS[18713:15766969] critical: 	4   libsystem_sim_c.dylib               0x04032a5a abort + 156
>2015-06-19 08:39:27.362 ComputersUnlimitedMedicalDeliveryAppiOS[18713:15766969] critical: 	5   ComputersUnlimitedMedicalDeliveryAppiOS 0x005a6556 xamarin_unhandled_exception_handler + 342
>2015-06-19 08:39:27.362 ComputersUnlimitedMedicalDeliveryAppiOS[18713:15766969] critical: 	6   ComputersUnlimitedMedicalDeliveryAppiOS 0x0040b9eb mono_invoke_unhandled_exception_hook + 91
>201
>5-06-19 08:39:27.362 ComputersUnlimitedMedicalDeliveryAppiOS[18713:15766969] critical: 	7   ComputersUnlimitedMedicalDeliveryAppiOS 0x0040a878 mono_handle_exception_internal + 6200
>2015-06-19 08:39:27.363 ComputersUnlimitedMedicalDeliveryAppiOS[18713:15766969] critical: 	8   ComputersUnlimitedMedicalDeliveryAppiOS 0x00409039 mono_handle_exception + 41
>2015-06-19 08:39:27.363 ComputersUnlimitedMedicalDeliveryAppiOS[18713:15766969] critical: 	9   ComputersUnlimitedMedicalDeliveryAppiOS 0x0039fef8 mono_x86_throw_exception + 136
>2015-06-19 08:39:27.363 ComputersUnlimitedMedicalDeliveryAppiOS[18713:15766969] critical: 	10  ???                                 0x0fe41f57 0x0 + 266608471
>2015-06-19 08:39:27.363 ComputersUnlimitedMedicalDeliveryAppiOS[18713:15766969] critical: 	11  ???                                 0x10a65434 0x0 + 279335988
>2015-06-19 08:39:27.363 ComputersUnlimitedMedicalDeliveryAppiOS[18713:15766969] critical: 	12  ???                                 0x10a652d0 0x0 + 279335632
>2015-06-19 08:39:27
>.364 ComputersUnlimitedMedicalDeliveryAppiOS[18713:15766969] critical: 	13  ???                                 0x10a65200 0x0 + 279335424
>2015-06-19 08:39:27.364 ComputersUnlimitedMedicalDeliveryAppiOS[18713:15766969] critical: 	14  ???                                 0x10a65248 0x0 + 279335496
>2015-06-19 08:39:27.364 ComputersUnlimitedMedicalDeliveryAppiOS[18713:15766969] critical: 	15  ???                                 0x10a65248 0x0 + 279335496
>2015-06-19 08:39:27.364 ComputersUnlimitedMedicalDeliveryAppiOS[18713:15766969] critical: 	16  ???                                 0x10a65030 0x0 + 279334960
>2015-06-19 08:39:27.364 ComputersUnlimitedMedicalDeliveryAppiOS[18713:15766969] critical: 	17  ???                                 0x10a64f40 0x0 + 279334720
>2015-06-19 08:39:27.364 ComputersUnlimitedMedicalDeliveryAppiOS[18713:15766969] critical: 	18  ???                                 0x10a64ea8 0x0 + 279334568
>2015-06-19 08:39:27.364 ComputersUnlimitedMedicalDeliveryAppiOS[18713:15766969] critical: 	19  
>???                                 0x108d2260 0x0 + 277684832
>2015-06-19 08:39:27.365 ComputersUnlimitedMedicalDeliveryAppiOS[18713:15766969] critical: 	20  ComputersUnlimitedMedicalDeliveryAppiOS 0x005a4e50 xamarin_register_entry_assembly + 32
>2015-06-19 08:39:27.365 ComputersUnlimitedMedicalDeliveryAppiOS[18713:15766969] critical: 	21  ComputersUnlimitedMedicalDeliveryAppiOS 0x005a29ed xamarin_main + 2349
>2015-06-19 08:39:27.365 ComputersUnlimitedMedicalDeliveryAppiOS[18713:15766969] critical: 	22  ComputersUnlimitedMedicalDeliveryAppiOS 0x00340311 main + 113
>2015-06-19 08:39:27.365 ComputersUnlimitedMedicalDeliveryAppiOS[18713:15766969] critical: 	23  libdyld.dylib                       0x03f8eac9 start + 1
>2015-06-19 08:39:27.365 ComputersUnlimitedMedicalDeliveryAppiOS[18713:15766969] 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 a
>pplication.
>=================================================================


## Steps to reproduce:

1. Open the linked project from the private comment below in Visual Studio. (Do not share)

2. Clean and deploy the project to an iOS Simulator. (If you don't clean first you might get an "Info.plist" not found error)

Expected result: App will display login screen after launch screen.

Actual result: App crashes during launch screen before login screen appears.

## Note

Linker option is set to Link SDK Assemblies Only for the Debug configuration. Don't Link is recommended and customer will use Don't Link as suggested to work on their app moving forward, but of course will eventually need the Link SDK Assemblies Option to work when they are ready to release their app. 


## Environment

Visual Studio:

Microsoft Visual Studio Ultimate 2013
Version 12.0.31101.00 Update 4
Microsoft .NET Framework
Version 4.6.00057

Installed Version: Ultimate

Architecture and Modeling Tools   06181-004-0451031-02209
Microsoft Architecture and Modeling Tools
    
UML® and Unified Modeling Language™ are trademarks or registered trademarks of the Object Management Group, Inc. in the United States and other countries.

LightSwitch for Visual Studio 2013   06181-004-0451031-02209
Microsoft LightSwitch for Visual Studio 2013

Team Explorer for Visual Studio 2013   06181-004-0451031-02209
Microsoft Team Explorer for Visual Studio 2013

Visual Basic 2013   06181-004-0451031-02209
Microsoft Visual Basic 2013

Visual C# 2013   06181-004-0451031-02209
Microsoft Visual C# 2013

Visual C++ 2013   06181-004-0451031-02209
Microsoft Visual C++ 2013

Visual F# 2013   06181-004-0451031-02209
Microsoft Visual F# 2013

Visual Studio 2013 Code Analysis Spell Checker   06181-004-0451031-02209
Microsoft® Visual Studio® 2013 Code Analysis Spell Checker

Portions of International CorrectSpell™ spelling correction system © 1993 by Lernout & Hauspie Speech Products N.V. All rights reserved.

The American Heritage® Dictionary of the English Language, Third Edition Copyright © 1992 Houghton Mifflin Company. Electronic version licensed from Lernout & Hauspie Speech Products N.V. All rights reserved.

Windows Phone SDK 8.0 - ENU   06181-004-0451031-02209
Windows Phone SDK 8.0 - ENU

Application Insights Tools for Visual Studio Package   1.0
Application Insights Tools for Visual Studio

ASP.NET and Web Tools   12.4.60320.0
Microsoft Web Developer Tools contains the following components:
Support for creating and opening ASP.NET web projects
Browser Link: A communication channel between Visual Studio and browsers
Editor extensions for HTML, CSS, and JavaScript
Page Inspector: Inspection tool for ASP.NET web projects
Scaffolding: A framework for building and running code generators
Server Explorer extensions for Microsoft Azure Web Apps
Web publishing: Extensions for publishing ASP.NET web projects to hosting providers, on-premises servers, or Microsoft Azure

ASP.NET Web Frameworks and Tools 2012.2   4.1.21001.0
For additional information, visit http://go.microsoft.com/fwlink/?LinkID=309563

ASP.NET Web Frameworks and Tools 2013   5.2.21010.0
For additional information, visit http://www.asp.net/

Common Azure Tools   1.3
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.

Microsoft Advertising SDK for Windows Phone   
Microsoft Advertising SDK for Windows Phone
Build 

Microsoft Azure HDInsight HQL Service   2.0.0.0000
Language service for Hive query

Microsoft Azure HDInsight Tools for Visual Studio   2.0.0.0000
An integrated development environment for HDInsight application development.

Microsoft Azure Mobile Services Tools   1.3
Microsoft Azure Mobile Services Tools

Microsoft Azure Tools   2.4
Microsoft Azure Tools for Microsoft Visual Studio 2013 - v2.4.20730.1601

Microsoft Azure Tools   2.5
Microsoft Azure Tools for Microsoft Visual Studio 2013 - v2.5.30319.1603

Multilingual App Toolkit   3.1.1250.0
Multilingual App Toolkit helps you localize your Windows Store app by providing file management, pseudo and machine translation, translation editor, and build integration. http://go.microsoft.com/fwlink?linkid=245767

NuGet Package Manager   2.8.60318.734
NuGet Package Manager in Visual Studio. For more information about NuGet, visit http://docs.nuget.org/.

Office Developer Tools for Visual Studio 2013 ENU   12.0.31105
Microsoft Office Developer Tools for Visual Studio 2013 ENU

PowerShell Tools   1.3
Provides file classification services using PowerShell

PreEmptive Analytics Visualizer   1.2
Microsoft Visual Studio extension to visualize aggregated summaries from the PreEmptive Analytics product.

SQL Server Data Tools   12.0.41025.0
Microsoft SQL Server Data Tools

Windows Azure Tools   2.3
Windows Azure Tools for Microsoft Visual Studio 2013 - v2.3.20320.1602

Windows Phone 8.1 SDK Integration   1.0
This package integrates the tools for the Windows Phone 8.1 SDK into the menus and controls of Visual Studio.

Workflow Manager Tools 1.0   1.0
This package contains the necessary Visual Studio integration components for Workflow Manager.

Xamarin   3.11.590.0 (5160db7)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin.Android   5.1.3.1 (d419c934e6ce2113653ff4c40214e3a5d5a69440)
Visual Studio plugin to enable development for Xamarin.Android.

Xamarin.Forms Intellisense   1.0
Provides intellisense for Xamarin.Forms in the XML editor.

Xamarin.iOS   8.10.1.0 (fce006eae308515fc1eaf85fcc0f90699d9c7e8b)
Visual Studio extension to enable development for Xamarin.iOS.

Xamarin.iOS Unified Migration   1.0
Automated migration for Xamarin iOS Classic projects to Unified

Xamarin.TestCloud.Integration   1.0
Early preview of Xamarin Test Cloud integration


Xamarin Studio:

=== Xamarin Studio ===

Version 5.9.3 (build 1)
Installation UUID: 2dc9022f-f9a8-424f-8284-bf224cbbfde0
Runtime:
	Mono 4.0.1 ((detached/ed1d3ec)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 400010044

=== Xamarin.Android ===

Version: 5.1.3.1 (Business Edition)
Android SDK: /Users/apple/Library/Developer/Xamarin/android-sdk-mac_x86
	Supported Android versions:
		2.3    (API level 10)
		4.0.3  (API level 15)
		4.1    (API level 16)
		4.2    (API level 17)
		4.3    (API level 18)
		4.4    (API level 19)
		4.4.87 (API level 20)
		5.0    (API level 21)
Java SDK: /usr
java version "1.7.0_79"
Java(TM) SE Runtime Environment (build 1.7.0_79-b15)
Java HotSpot(TM) 64-Bit Server VM (build 24.79-b02, mixed mode)

=== Xamarin Android Player ===

Version: Unknown version
Location: /Applications/Xamarin Android Player.app

=== Apple Developer Tools ===

Xcode 6.3.2 (7718)
Build 6D2105

=== Xamarin.iOS ===

Version: 8.10.1.64 (Business Edition)
Hash: e6ebd18
Branch: master
Build date: 2015-05-21 21:55:09-0400

=== Xamarin.Mac ===

Version: 2.0.1.64 (Business Edition)

=== Build Information ===

Release ID: 509030001
Git revision: 5a524e1726ed103fdd4fe37e0356f2b35466ce9d
Build date: 2015-06-02 16:35:08-04
Xamarin addins: 51957cfbd06be911b212671ad05c2c6221ac90f9

=== Operating System ===

Mac OS X 10.10.3
Darwin Jons-iMac.local 14.3.0 Darwin Kernel Version 14.3.0
    Mon Mar 23 11:59:05 PDT 2015
    root:xnu-2782.20.48~5/RELEASE_X86_64 x86_64
Comment 3 Brendan Zagaeski (Xamarin Team, assistant) 2015-06-25 13:58:10 UTC
Thanks for the report and the test case.

I was able to trim down the original test case to just a few lines of code that use the Refit NuGet package. Using that minimal test case, I was able to trace the problem to being an issue with Xamarin.iOS rather than XamarinVS.

I have accordingly filed a new bug with the new tiny test case: Bug 31379. For tidiness, I will now mark this bug as a duplicate of that new bug.


## Side note

As I was working on minimizing the test case, I discovered that the the "Models" PCL project references `Components\sqlcipher-for-xamarin-android-3.3.0.0\lib\android\Mono.Data.Sqlcipher.dll` which is _not_ a PCL library. In theory, that platform-specific SQLCipher library should not be used as a reference in any PCL. If that reference is working as desired right now, it is purely "by luck." It could stop working in any future Xamarin release. I would recommend re-organizing the solution to avoid referencing that platform-dependent library in the PCL.

*** This bug has been marked as a duplicate of bug 31379 ***