internal void RevertToParent(ConfigurationSection configSection) {
// Remove any RawXml set by ConfigurationSection.SetRawXml
configSection.SectionInformation.RawXml = null;
try {
// Reset to parent value
ConfigurationSection parentConfigSection = FindImmediateParentSection(configSection);
configSection.Reset(parentConfigSection);
configSection.ResetModified();
}
catch (Exception e) {
throw new ConfigurationErrorsException(SR.GetString(SR.Config_exception_in_config_section_handler, configSection.SectionInformation.SectionName),
e, ConfigStreamInfo.StreamName, 0);
}
catch {
throw new ConfigurationErrorsException(SR.GetString(SR.Config_exception_in_config_section_handler, configSection.SectionInformation.SectionName),
null, ConfigStreamInfo.StreamName, 0);
}
// Record that the section is to be removed.
configSection.SectionInformation.Removed = true;
}