diff --git a/Rules/UseIdenticalMandatoryParametersDSC.cs b/Rules/UseIdenticalMandatoryParametersDSC.cs index 34ef8b47f..1ba4c30da 100644 --- a/Rules/UseIdenticalMandatoryParametersDSC.cs +++ b/Rules/UseIdenticalMandatoryParametersDSC.cs @@ -241,21 +241,14 @@ private IDictionary GetKeys(string fileName) var errors = new System.Collections.ObjectModel.Collection(); var keys = new List(); List 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( cimClass?.CimSuperClass?.CimClassProperties.Select(cimPropertyDeclaration => cimPropertyDeclaration.Name) ??