OS Version: Windows 10 x64 1803
WMF Version: 5.1
Impact: High
Description:
On new installations, PowerShell Studio will build the module cache and declare that action finished.
However, it will not cache any content from any of my modules, leaving me without any Primal Sense on my most critical commands.
On existing installations, it will not update the cache anymore.
Impacted Modules:
- PSFramework
- PSUtil (Depends on PSFramework)
- PSModuleDevelopment (Depends on PSFramework)
I'm assuming the CacheBuilder has problems with loading PSFramework, however I was unable to find any relevant logs.
Reproducibility:
Install the PSFramework Module and have PowerShell Studio refresh the cache.
Once done, test Primal Sense, for example for the command Write-PSFMessage.
Workarounds / Mitigations:
I have built command that will calculate the cache entries for me.
Using that command I can successfully inject up-to-date values into the Primal Sense.
Once done this way, it will even pick up Enumerated Types for Primal Sense as input options, so the core Application has no issues working with it.
- function New-PSSModuleCache
- {
- [CmdletBinding()]
- param (
- [Parameter(Mandatory = $true, ValueFromPipeline = $true)]
- [System.Management.Automation.PSModuleInfo[]]
- $Module
- )
- begin
- {
- $common = 'Verbose', 'Debug', 'ErrorAction', 'WarningAction', 'InformationAction', 'ErrorVariable', 'WarningVariable', 'InformationVariable', 'OutVariable', 'OutBuffer', 'PipelineVariable'
- }
- process
- {
- foreach ($moduleItem in $Module)
- {
- $ctext = @()
- $mtext = '{0}|{1}|' -f $moduleItem.Name, $moduleItem.Version.ToString()
- $atext = @()
- # Write Header
- $ctext += '[Module]'
- $ctext += '{0}|{1}|{2}' -f $moduleItem.Name, $moduleItem.Version.ToString(), $moduleItem.Description
- $commands = $moduleItem.ExportedCommands.Values
- foreach ($command in $commands)
- {
- if ($command.CommandType -like "Alias")
- {
- $atext += '{0} {1}' -f $command.Name, $command.ResolvedCommand.Name
- continue
- }
- $help = Get-Help -Name $command.Name
- $ctext += '[Command]'
- $ctext += '{0}|{1}|C' -f $command.CommandType, $command.Name
- $ctext += ''
- $ctext += $help.Synopsis
- $ctext += '[Syntax]'
- foreach ($set in $command.ParameterSets)
- {
- $ctext += '{0}|{1} {2}' -f $set.Name, $command.Name, $set.ToString()
- }
- $ctext += '[Outputs]'
- foreach ($set in $command.ParameterSets)
- {
- if ($command.OutputType)
- {
- $ctext += '{0}|{1}' -f $set.Name, $command.OutputType[0].Type.ToString()
- }
- else { $ctext += '{0}|System.Management.Automation.PSObject[]' -f $set.Name }
- }
- $ctext += '[Parameters]'
- foreach ($parameter in $command.Parameters.Values)
- {
- if ($parameter.Name -in $common) { continue }
- $ctext += '{0}|{1}|' -f $parameter.Name, $parameter.ParameterType
- }
- }
- [pscustomobject]@{
- PSTypeName = 'PSS.Module.Cache'
- Module = $mtext
- Aliases = $atext -join "`n"
- Commands = $ctext -join "`n"
- }
- }
- }
- }
This issue also existed in the previous version.