Mac中的单声道应用程序失败,出现“System.MissingMethodException:找不到类型System.Configuration.ExeConfigurationHost的默认构造函数”

时间:2012-01-21 02:41:36

标签: c# .net macos mono mkbundle

这段代码基本上是在进行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 个答案:

答案 0 :(得分:2)

这是known issue。解决方法是禁用应用程序中的托管链接器(因为它将删除通过反射使用System.Net配置的类型)。