Skip to content
17 changes: 5 additions & 12 deletions Rules/UseIdenticalMandatoryParametersDSC.cs
Original file line number Diff line number Diff line change
Expand Up @@ -241,21 +241,14 @@ private IDictionary<string, string> GetKeys(string fileName)
var errors = new System.Collections.ObjectModel.Collection<Exception>();
var keys = new List<string>();
List<CimClass> cimClasses = null;
try
if (!isDSCClassCacheInitialized)
{
if (!isDSCClassCacheInitialized)
{
DscClassCache.Initialize();
isDSCClassCacheInitialized = true;
}

cimClasses = dscClassImporter(mofFilepath, moduleInfo, errors);
}
catch
{
// todo log the error
DscClassCache.Initialize();
isDSCClassCacheInitialized = true;
}

cimClasses = dscClassImporter(mofFilepath, moduleInfo, errors);

var cimClass = cimClasses?.FirstOrDefault();
var cimSuperClassProperties = new HashSet<string>(
cimClass?.CimSuperClass?.CimClassProperties.Select(cimPropertyDeclaration => cimPropertyDeclaration.Name) ??
Expand Down