Сбой приложения Mono в Mac с «System.MissingMethodException: конструктор по умолчанию не найден для типа System.Configuration.ExeConfigurationHost» - PullRequest
1 голос
/ 21 января 2012

Этот код в основном выполняет HTTP-вызов, когда он пытается его выполнить, он просто терпит неудачу, но только когда приложение упаковано как приложение Mac, этого не происходит, когда я запускаю приложение внутри MonoDevelop.

У кого-нибудь есть намеки на то, что это может быть?

РЕДАКТИРОВАТЬ

Я видел, как люди много говорили о mkbundle и config , но я нигде не вижу его при создании пакета приложений Mac для MonoDevelop.

Unhandled Exception: System.TypeInitializationException: An exception was thrown by the type initializer for OfficeDrop.Core.Api.JsonOfficeDropApi ---> System.TypeInitializationException: An exception was thrown by the type initializer for System.Net.ServicePointManager ---> System.Configuration.ConfigurationErrorsException: Error Initializing the configuration system. ---> System.MissingMethodException: Default constructor not found for type System.Configuration.ExeConfigurationHost.
  at System.Activator.CreateInstance (System.Type type, Boolean nonPublic) [0x00000] in <filename unknown>:0 
  at System.Activator.CreateInstance (System.Type type) [0x00000] in <filename unknown>:0 
  at System.Configuration.InternalConfigurationSystem.Init (System.Type typeConfigHost, System.Object[] hostInitParams) [0x00000] in <filename unknown>:0 
  at System.Configuration.InternalConfigurationFactory.Create (System.Type typeConfigHost, System.Object[] hostInitConfigurationParams) [0x00000] in <filename unknown>:0 
  at System.Configuration.ConfigurationManager.OpenExeConfigurationInternal (ConfigurationUserLevel userLevel, System.Reflection.Assembly calling_assembly, System.String exePath) [0x00000] in <filename unknown>:0 
  at System.Configuration.ClientConfigurationSystem.get_Configuration () [0x00000] in <filename unknown>:0 
  --- End of inner exception stack trace ---
  at System.Configuration.ClientConfigurationSystem.get_Configuration () [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.Net.ServicePointManager..cctor () [0x00000] in <filename unknown>:0 
  --- End of inner exception stack trace ---
  at OfficeDrop.Core.Api.JsonOfficeDropApi..cctor () [0x00000] in <filename unknown>:0 
  --- End of inner exception stack trace ---
at SyncDropMac.MainWindowController..ctor () <0x0000b>
at SyncDropMac.AppDelegate.FinishedLaunching (MonoMac.Foundation.NSObject) <0x00023>
at (wrapper dynamic-method) object.[SyncDropMac.AppDelegate.Void FinishedLaunching(MonoMac.Foundation.NSObject)] (MonoMac.Foundation.NSObject,MonoMac.ObjCRuntime.Selector,MonoMac.Foundation.NSObject) <0x00030>
at (wrapper native-to-managed) object.[SyncDropMac.AppDelegate.Void FinishedLaunching(MonoMac.Foundation.NSObject)] (MonoMac.Foundation.NSObject,MonoMac.ObjCRuntime.Selector,MonoMac.Foundation.NSObject) <0x000fb>
at (wrapper managed-to-native) MonoMac.AppKit.NSApplication.NSApplicationMain (int,string[]) <0x00003>
at MonoMac.AppKit.NSApplication.Main (string[]) <0x00017>
at SyncDropMac.MainClass.Main (string[]) <0x00017>

[ERROR] FATAL UNHANDLED EXCEPTION: System.TypeInitializationException: An exception was thrown by the type initializer for OfficeDrop.Core.Api.JsonOfficeDropApi ---> System.TypeInitializationException: An exception was thrown by the type initializer for System.Net.ServicePointManager ---> System.Configuration.ConfigurationErrorsException: Error Initializing the configuration system. ---> System.MissingMethodException: Default constructor not found for type System.Configuration.ExeConfigurationHost.
  at System.Activator.CreateInstance (System.Type type, Boolean nonPublic) [0x00000] in <filename unknown>:0 
  at System.Activator.CreateInstance (System.Type type) [0x00000] in <filename unknown>:0 
  at System.Configuration.InternalConfigurationSystem.Init (System.Type typeConfigHost, System.Object[] hostInitParams) [0x00000] in <filename unknown>:0 
  at System.Configuration.InternalConfigurationFactory.Create (System.Type typeConfigHost, System.Object[] hostInitConfigurationParams) [0x00000] in <filename unknown>:0 
  at System.Configuration.ConfigurationManager.OpenExeConfigurationInternal (ConfigurationUserLevel userLevel, System.Reflection.Assembly calling_assembly, System.String exePath) [0x00000] in <filename unknown>:0 
  at System.Configuration.ClientConfigurationSystem.get_Configuration () [0x00000] in <filename unknown>:0 
  --- End of inner exception stack trace ---
  at System.Configuration.ClientConfigurationSystem.get_Configuration () [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.Net.ServicePointManager..cctor () [0x00000] in <filename unknown>:0 
  --- End of inner exception stack trace ---
  at OfficeDrop.Core.Api.JsonOfficeDropApi..cctor () [0x00000] in <filename unknown>:0 
  --- End of inner exception stack trace ---
at SyncDropMac.MainWindowController..ctor () <0x0000b>
at SyncDropMac.AppDelegate.FinishedLaunching (MonoMac.Foundation.NSObject) <0x00023>
at (wrapper dynamic-method) object.[SyncDropMac.AppDelegate.Void FinishedLaunching(MonoMac.Foundation.NSObject)] (MonoMac.Foundation.NSObject,MonoMac.ObjCRuntime.Selector,MonoMac.Foundation.NSObject) <0x00030>
at (wrapper native-to-managed) object.[SyncDropMac.AppDelegate.Void FinishedLaunching(MonoMac.Foundation.NSObject)] (MonoMac.Foundation.NSObject,MonoMac.ObjCRuntime.Selector,MonoMac.Foundation.NSObject) <0x000fb>
at (wrapper managed-to-native) MonoMac.AppKit.NSApplication.NSApplicationMain (int,string[]) <0x00003>
at MonoMac.AppKit.NSApplication.Main (string[]) <0x00017>
at SyncDropMac.MainClass.Main (string[]) <0x00017>

1 Ответ

2 голосов
/ 21 января 2012

Это известная проблема . Обходной путь - отключить управляемый компоновщик в вашем приложении (так как он удалит типы, которые используются, для отражения, для конфигурации System.Net).

...