protected object CallCreateSection(bool inputIsTrusted, FactoryRecord factoryRecord, SectionRecord sectionRecord, object parentConfig, ConfigXmlReader reader, string filename, int line) {
object config;
// Call into config section while impersonating process or UNC identity
// so that the section could read files from disk if needed
try {
using (Impersonate()) {
config = CreateSection(inputIsTrusted, factoryRecord, sectionRecord, parentConfig, reader);
if (config == null && parentConfig != null) {
throw new ConfigurationErrorsException(SR.GetString(SR.Config_object_is_null), filename, line);
}
}
}
catch (Exception e) {
throw ExceptionUtil.WrapAsConfigException(SR.GetString(SR.Config_exception_creating_section_handler, factoryRecord.ConfigKey), e, filename, line);
}
catch {
throw ExceptionUtil.WrapAsConfigException(SR.GetString(SR.Config_exception_creating_section_handler, factoryRecord.ConfigKey), null, filename, line);
}
return config;
}