internal FactoryRecord FindFactoryRecord(string configKey, bool permitErrors, out BaseConfigurationRecord configRecord) {
configRecord = null;
BaseConfigurationRecord tConfigRecord = this;
while (!tConfigRecord.IsRootConfig) {
FactoryRecord factoryRecord = tConfigRecord.GetFactoryRecord(configKey, permitErrors);
if (factoryRecord != null) {
#if DBG
if (IsImplicitSection(configKey) && !factoryRecord.HasErrors) {
Debug.Assert(tConfigRecord._parent.IsRootConfig,
"Implicit section should be found only at the record beneath the root (e.g. machine.config)");
}
#endif
configRecord = tConfigRecord;
return factoryRecord;
}
tConfigRecord = tConfigRecord._parent;
}
return null;
}