private static void EnsureConfigurationSystem() {
// If a configuration system has not yet been set,
// create the DefaultConfigurationSystem for exe's.
lock (s_initLock) {
if (s_initState < InitState.Usable) {
s_initState = InitState.Started;
try {
try {
// Create the system, but let it initialize itself
// when GetConfig is called, so that it can handle its
// own re-entrancy issues during initialization.
// When initialization is complete, the DefaultConfigurationSystem
// will call CompleteConfigInit to mark initialization as
// having completed.
// Note: the ClientConfigurationSystem has a 2-stage initialization,
// and that's why s_initState isn't set to InitState.Completed yet.
s_configSystem = new ClientConfigurationSystem();
s_initState = InitState.Usable;
}
catch (Exception e) {
s_initError = new ConfigurationErrorsException(SR.GetString(SR.Config_client_config_init_error), e);
throw s_initError;
}
catch {
s_initError = new ConfigurationErrorsException(SR.GetString(SR.Config_client_config_init_error));
throw s_initError;
}
}
catch {
s_initState = InitState.Completed;
throw;
}
}
}
}