Bug 17191 - App only runs if Linker Behavior is set to Don't Link
Summary: App only runs if Linker Behavior is set to Don't Link
Status: RESOLVED NORESPONSE
Alias: None
Product: Xamarin.Mac
Classification: Desktop
Component: mmp ()
Version: 1.6.19
Hardware: Macintosh Mac OS
: Normal normal
Target Milestone: ---
Assignee: Sebastien Pouliot
URL:
Depends on:
Blocks:
 
Reported: 2014-01-11 17:17 UTC by askgl
Modified: 2015-02-20 18:16 UTC (History)
5 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 or GitHub 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 NORESPONSE

Description askgl 2014-01-11 17:17:55 UTC
Using XamMac and tried on almost all versions of Xamarin Studio (4.x beta/stable/alpha). I've tried --linkskip=System.ComponentModel.Composition and --linkskip=System.Diagnostics (along with mscorlib, System.dll etc) but no luck.

Unhandled Exception:
System.TypeInitializationException: An exception was thrown by the type initializer for System.ComponentModel.Composition.Diagnostics.CompositionTraceSource ---> System.TypeInitializationException: An exception was thrown by the type initializer for System.ComponentModel.Composition.Diagnostics.TraceSourceTraceWriter ---> System.Configuration.ConfigurationErrorsException: Type 'System.Diagnostics.DiagnosticsConfigurationHandler, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' not found.
  at System.Configuration.InternalConfigurationHost.GetConfigType (System.String typeName, Boolean throwOnError) [0x00000] in <filename unknown>:0 
  at System.Configuration.ConfigInfo.CreateInstance () [0x00000] in <filename unknown>:0 
  at System.Configuration.SectionInfo.CreateInstance () [0x00000] in <filename unknown>:0 
  at System.Configuration.Configuration.GetSectionInstance (System.Configuration.SectionInfo config, Boolean createDefaultInstance) [0x00000] in <filename unknown>:0 
  at System.Configuration.ConfigurationSectionCollection.get_Item (System.String name) [0x00000] in <filename unknown>:0 
  at System.Configuration.Configuration.GetSection (System.String path) [0x00000] in <filename unknown>:0 
  at System.Configuration.ClientConfigurationSystem.System.Configuration.Internal.IInternalConfigSystem.GetSection (System.String configKey) [0x00000] in <filename unknown>:0 
  at System.Configuration.ConfigurationManager.GetSection (System.String sectionName) [0x00000] in <filename unknown>:0 
  at System.Configuration.ConfigurationSettings.GetConfig (System.String sectionName) [0x00000] in <filename unknown>:0 
  at System.Diagnostics.DiagnosticsConfiguration.get_Settings () [0x00000] in <filename unknown>:0 
  at System.Diagnostics.TraceSource..ctor (System.String name, SourceLevels defaultLevel) [0x00000] in <filename unknown>:0 
  at System.ComponentModel.Composition.Diagnostics.TraceSourceTraceWriter..cctor () [0x00000] in <filename unknown>:0 
  --- End of inner exception stack trace ---
  at System.ComponentModel.Composition.Diagnostics.CompositionTraceSource..cctor () [0x00000] in <filename unknown>:0 
  --- End of inner exception stack trace ---
  at System.ComponentModel.Composition.Diagnostics.CompositionTrace.DefinitionContainsNoExports (System.Type type) [0x00000] in <filename unknown>:0 
  at System.ComponentModel.Composition.AttributedModel.AttributedPartCreationInfo.IsPartDiscoverable () [0x00000] in <filename unknown>:0 
  at System.ComponentModel.Composition.AttributedModel.AttributedModelDiscovery.CreatePartDefinitionIfDiscoverable (System.Type type, ICompositionElement origin) [0x00000] in <filename unknown>:0 
  at System.ComponentModel.Composition.Hosting.TypeCatalog.get_PartsInternal () [0x00000] in <filename unknown>:0 
  at System.ComponentModel.Composition.Hosting.TypeCatalog.CreateIndex () [0x00000] in <filename unknown>:0 
  at System.Lazy`1[System.Collections.Generic.IDictionary`2[System.String,System.Collections.Generic.List`1[System.ComponentModel.Composition.Primitives.ComposablePartDefinition]]].InitValue () [0x00000] in <filename unknown>:0 
[ERROR] FATAL UNHANDLED EXCEPTION: System.TypeInitializationException: An exception was thrown by the type initializer for System.ComponentModel.Composition.Diagnostics.CompositionTraceSource ---> System.TypeInitializationException: An exception was thrown by the type initializer for System.ComponentModel.Composition.Diagnostics.TraceSourceTraceWriter ---> System.Configuration.ConfigurationErrorsException: Type 'System.Diagnostics.DiagnosticsConfigurationHandler, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' not found.
  at System.Configuration.InternalConfigurationHost.GetConfigType (System.String typeName, Boolean throwOnError) [0x00000] in <filename unknown>:0 
  at System.Configuration.ConfigInfo.CreateInstance () [0x00000] in <filename unknown>:0 
  at System.Configuration.SectionInfo.CreateInstance () [0x00000] in <filename unknown>:0 
  at System.Configuration.Configuration.GetSectionInstance (System.Configuration.SectionInfo config, Boolean createDefaultInstance) [0x00000] in <filename unknown>:0 
  at System.Configuration.ConfigurationSectionCollection.get_Item (System.String name) [0x00000] in <filename unknown>:0 
  at System.Configuration.Configuration.GetSection (System.String path) [0x00000] in <filename unknown>:0 
  at System.Configuration.ClientConfigurationSystem.System.Configuration.Internal.IInternalConfigSystem.GetSection (System.String configKey) [0x00000] in <filename unknown>:0 
  at System.Configuration.ConfigurationManager.GetSection (System.String sectionName) [0x00000] in <filename unknown>:0 
  at System.Configuration.ConfigurationSettings.GetConfig (System.String sectionName) [0x00000] in <filename unknown>:0 
  at System.Diagnostics.DiagnosticsConfiguration.get_Settings () [0x00000] in <filename unknown>:0 
  at System.Diagnostics.TraceSource..ctor (System.String name, SourceLevels defaultLevel) [0x00000] in <filename unknown>:0 
  at System.ComponentModel.Composition.Diagnostics.TraceSourceTraceWriter..cctor () [0x00000] in <filename unknown>:0 
  --- End of inner exception stack trace ---
  at System.ComponentModel.Composition.Diagnostics.CompositionTraceSource..cctor () [0x00000] in <filename unknown>:0 
  --- End of inner exception stack trace ---
  at System.ComponentModel.Composition.Diagnostics.CompositionTrace.DefinitionContainsNoExports (System.Type type) [0x00000] in <filename unknown>:0 
  at System.ComponentModel.Composition.AttributedModel.AttributedPartCreationInfo.IsPartDiscoverable () [0x00000] in <filename unknown>:0 
  at System.ComponentModel.Composition.AttributedModel.AttributedModelDiscovery.CreatePartDefinitionIfDiscoverable (System.Type type, ICompositionElement origin) [0x00000] in <filename unknown>:0 
  at System.ComponentModel.Composition.Hosting.TypeCatalog.get_PartsInternal () [0x00000] in <filename unknown>:0 
  at System.ComponentModel.Composition.Hosting.TypeCatalog.CreateIndex () [0x00000] in <filename unknown>:0 
  at System.Lazy`1[System.Collections.Generic.IDictionary`2[System.String,System.Collections.Generic.List`1[System.ComponentModel.Composition.Primitives.ComposablePartDefinition]]].InitValue () [0x00000] in <filename unknown>:0
Comment 1 askgl 2014-01-11 19:32:19 UTC
I got this working using following linkskips:

--linkskip=System.ComponentModel.Composition --linkskip=System.Configuration  --linkskip=XamMac --linkskip=System.Xml

I had to linkskip XamMac as well to fix some null reference exceptions. But now I'm stuck with this stupid bug: http://forums.xamarin.com/discussion/12204/mdtool-system-badimageformatexception-xamarin-macdev-dll#latest

Has been stuck for three days now trying to build my app from command line so that I can put it on TeamCity for CI. This is so frustrating. One thing works and another breaks.
Comment 2 Jatin 2014-10-29 07:46:16 UTC
Hi,

I have tried to reproduce this issue using the latest stable builds, and I was not able to reproduce this issue at my end.

Below are the steps I followed:

1. Create a new Xamarin.Mac project.
2. Set the project to the "Debug" configuration.
3. Under "Project Options -> Mac OS X Packaging", change the Identity to "Mac
Developer (Automatic)", or pick a "Mac Developer: ..." Identity that has a
provisioning profile.
4. Build and run the project.

And also I tried to set the Linker Behavior as  (Don't Link, Link SDK Only, and Link All) and with Entitlements enable and disabled. 

And with all the above permutation and combination the application run successfully without throwing any exception.

Please check it at your end using the latest stable builds and let me know if you are still facing the same problem. Also provide the following additional information: (IDE logs through Help >> Open Log Directory >> IDE logs as per date and time).

Below is the build information for the latest stable build:
=== Xamarin Studio ===

Version 5.5.3 (build 6)
Installation UUID: ff0c16c6-3c75-46d8-ac56-56c3b56e2c76
Runtime:
 Mono 3.10.0 ((detached/e204655)
 GTK+ 2.24.23 (Raleigh theme)

 Package version: 310000023

=== Apple Developer Tools ===

Xcode 6.1 (6604)
Build 6A1052d

=== Xamarin.Android ===

Version: 4.18.0 (Indie Edition)
Android SDK: /Users/360_macmini/Desktop/android-sdk-macosx
 Supported Android versions:
  2.1    (API level 7)
  2.2    (API level 8)
  2.3    (API level 10)
  3.1    (API level 12)
  3.2    (API level 13)
  4.0    (API level 14)
  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)
  4.5    (API level 21)
Java SDK: /usr
java version "1.7.0_65"
Java(TM) SE Runtime Environment (build 1.7.0_65-b17)
Java HotSpot(TM) 64-Bit Server VM (build 24.65-b04, mixed mode)

=== Xamarin.iOS ===

Version: 8.4.0.15 (Trial Edition)
Hash: 08968c4
Branch: 
Build date: 2014-10-20 21:48:06-0400

=== Xamarin.Mac ===

Version: 1.10.0.18 (Indie Edition)

=== Build Information ===

Release ID: 505030006
Git revision: fbe3e9453daf6a3bb9a9709ed22bec35f7c9056b
Build date: 2014-10-23 13:08:38-04
Xamarin addins: e44add2b39de4dd57c0742bb2e620dfad84c64c6

=== Operating System ===

Mac OS X 10.10.0
Darwin Apples-iMac.local 14.0.0 Darwin Kernel Version 14.0.0
    Fri Sep 19 00:26:44 PDT 2014
    root:xnu-2782.1.97~2/RELEASE_X86_64 x86_64
Comment 3 Chris Hamons 2015-02-20 18:16:48 UTC
@askgl

This bug doesn't have any steps to reproduce, so I'm having trouble. Since the last request for steps to reproduce / repro case was month ago, I'm going to close this bug.

Please feel free to reopen this bug with more information or file another if the problem still persists. 

Thanks!