Warnings on Script Execution in Start-PSFRunSpace

Hi there,

I am inconsistently getting this warning and I’m not sure what to do to get rid of it.

Apr 21, 2022 2:10 PM [warning] [13:10:05][Start-PSFRunspace] Failed to start runspace: PSFramework.Logging | Exception calling “Start” with “0” argument(s): “Object reference not set to an instance of an object.”

I also see this as well.
Apr 21, 2022 2:15 PM [warning] [13:15:05][Start-PSFRunspace] Failed to start runspace: PSFramework.Logging | Exception calling “Start” with “0” argument(s): "Cannot perform operation because object “PowerShell” has already been disposed.

It does not happen all the time, probably 50-60%. The script presents this very quickly, then processed to run as normal, but as a result the script gets flagged with a warning.
I did some google searches and found what module it is part of, but not much else. I assume this module is part of Powershell Universal, but also understand it may not be.

I’m running PWSH 7.2 on the server where this is running, and this is running in a non-persistent, non-high performance runspace pool.

Thanks in advance for any assistance that can be provided.

Product: PowerShell Universal
Version: 2.10.1

I’ve seen the same thing, though much less frequently (around once every couple of days). And mine doesn’t seem tied to an actual schedule/job, but because I defined the PSFramework logging provider to this folder, I’m assuming it may be an internal PSU logging function or something. I’m currently running v2.8.1 of PSU:

We don’t use this module directly in PSU so it must just be interacting poorly with it. You might be able to try and capture the stack trace to see if you can get some more info out of PSF.

try {
} catch {

Good to know. I’m not sure Start-PSFRunspace is a public cmdlet within the module since the only commands I use from it are the Set-PSFLoggingProvider and Write-PSFMessage. But will keep that in mind and see if can track it down when I have time. It doesn’t appear to be hurting anything for us at the moment.

I found the module PSFramework was installed in the Universal folder, so I trashed it to see what it would do. Its throwing full errors now, but it has identified where it actually came from.

Apr 21, 2022 4:41 PM [error] The required module 'PSFramework' is not loaded. Load the module or remove the module from 'RequiredModules' in the file 'C:\ProgramData\UniversalAutomation\Repository\Modules\SecretManagement.Keepass\0.9.2\SecretManagement.Keepass.psd1'.

Seems as though the KeePass module is using it for some reason.

Yeah it looks like it’s using it for logging. I can open an issue for this module to see what’s up since I know it’s pretty popular.