Quantcast
Channel: Xamarin.Mac — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 1429

System.Configuration.ConfigurationErrorsException: Error Initializing the configuration system.

$
0
0

Hi,

Since I've started always including the Mono runtime in the app bundle, I've been having this exception:

System.TypeInitializationException: The type initializer for 'System.Net.ServicePointManager' threw an exception. ---> System.Configuration.ConfigurationErrorsException: Error Initializing the configuration system. ---> System.NullReferenceException: Object reference not set to an instance of an object
  at System.Configuration.Configuration.FindLocationConfiguration (System.String relativePath, System.Configuration.Configuration defaultConfiguration) [0x00040] in /private/tmp/source-mono-4.8.0/bockbuild-mono-4.8.0-branch/profiles/mono-mac-xamarin/build-root/mono-x86/mcs/class/System.Configuration/System.Configuration/Configuration.cs:111
  at System.Configuration.Configuration..ctor (System.Configuration.InternalConfigurationSystem system, System.String locationSubPath) [0x0004e] in /private/tmp/source-mono-4.8.0/bockbuild-mono-4.8.0-branch/profiles/mono-mac-xamarin/build-root/mono-x86/mcs/class/System.Configuration/System.Configuration/Configuration.cs:93
  at System.Configuration.InternalConfigurationFactory.Create (System.Type typeConfigHost, System.Object[] hostInitConfigurationParams) [0x0000e] in /private/tmp/source-mono-4.8.0/bockbuild-mono-4.8.0-branch/profiles/mono-mac-xamarin/build-root/mono-x86/mcs/class/System.Configuration/System.Configuration/InternalConfigurationFactory.cs:41
  at System.Configuration.ConfigurationManager.OpenExeConfigurationInternal (System.Configuration.ConfigurationUserLevel userLevel, System.Reflection.Assembly calling_assembly, System.String exePath) [0x00102] in /private/tmp/source-mono-4.8.0/bockbuild-mono-4.8.0-branch/profiles/mono-mac-xamarin/build-root/mono-x86/mcs/class/System.Configuration/System.Configuration/ConfigurationManager.cs:119
  at System.Configuration.ClientConfigurationSystem.get_Configuration () [0x00011] in /private/tmp/source-mono-4.8.0/bockbuild-mono-4.8.0-branch/profiles/mono-mac-xamarin/build-root/mono-x86/mcs/class/System.Configuration/System.Configuration/ClientConfigurationSystem.cs:49
  --- End of inner exception stack trace ---
  at System.Configuration.ClientConfigurationSystem.get_Configuration () [0x00025] in /private/tmp/source-mono-4.8.0/bockbuild-mono-4.8.0-branch/profiles/mono-mac-xamarin/build-root/mono-x86/mcs/class/System.Configuration/System.Configuration/ClientConfigurationSystem.cs:52
  at System.Configuration.ClientConfigurationSystem.System.Configuration.Internal.IInternalConfigSystem.GetSection (System.String configKey) [0x00000] in /private/tmp/source-mono-4.8.0/bockbuild-mono-4.8.0-branch/profiles/mono-mac-xamarin/build-root/mono-x86/mcs/class/System.Configuration/System.Configuration/ClientConfigurationSystem.cs:61
  at System.Configuration.ConfigurationManager.GetSection (System.String sectionName) [0x00000] in /private/tmp/source-mono-4.8.0/bockbuild-mono-4.8.0-branch/profiles/mono-mac-xamarin/build-root/mono-x86/mcs/class/System.Configuration/System.Configuration/ConfigurationManager.cs:159
  at System.Net.ServicePointManager..cctor () [0x00040] in /private/tmp/source-mono-4.8.0/bockbuild-mono-4.8.0-branch/profiles/mono-mac-xamarin/build-root/mono-x86/mcs/class/System/System.Net/ServicePointManager.cs:150

This happens specifically when I set the ServerCertificateValidationCallback of the ServicePointManager slightly after the launch of the app. This does only occurs occasionally though. This would happen on anything that would end up calling System.Configuration.Configuration.FindLocationConfiguration (in the initialization of a System.Xml.Serialization.XmlSerializer for instance).

I'm kind of at a loss here and ended up catching the exception and restarting the app when it does, which is horrible, I know, but will have to suffice for now. The random nature of the exception certainly does not help me figure it out.

Any ideas?

Thanks,


Viewing all articles
Browse latest Browse all 1429

Trending Articles