@@ -234,10 +234,10 @@ function Invoke-DscCacheRefresh {
234234 }
235235
236236 $dscResourceCacheEntries.Add ([dscResourceCacheEntry ]@ {
237- Type = " $moduleName /$ ( $dscResource.Name ) "
238- DscResourceInfo = $DscResourceInfo
239- LastWriteTimes = $lastWriteTimes
240- })
237+ Type = " $moduleName /$ ( $dscResource.Name ) "
238+ DscResourceInfo = $DscResourceInfo
239+ LastWriteTimes = $lastWriteTimes
240+ })
241241 }
242242
243243 if ($namedModules.Count -gt 0 ) {
@@ -578,14 +578,14 @@ function GetClassBasedProperties {
578578 return @ (' get' , ' set' , ' test' )
579579 }
580580
581- $module = Get-ChildItem - Path ( Split-Path $filePath - Parent) - Filter * .psm1 - File | Select-Object - First 1 - ExpandProperty FullName
581+ $module = Import-Module $filePath - PassThru - Force - ErrorAction Ignore
582582
583583 $properties = [System.Collections.Generic.List [DscResourcePropertyInfo ]]::new()
584584
585- if (Test-Path $module - ErrorAction Ignore) {
585+ if (Test-Path $module.Path - ErrorAction Ignore) {
586586 [System.Management.Automation.Language.Token []] $tokens = $null
587587 [System.Management.Automation.Language.ParseError []] $errors = $null
588- $ast = [System.Management.Automation.Language.Parser ]::ParseFile($module , [ref ]$tokens , [ref ]$errors )
588+ $ast = [System.Management.Automation.Language.Parser ]::ParseFile($module.Path , [ref ]$tokens , [ref ]$errors )
589589 foreach ($e in $errors ) {
590590 $e | Out-String | Write-DscTrace - Operation Error
591591 }
0 commit comments