#27982·PowerShell

Remote session (wsmprovhost.exe) cannot resolve assemblies due to PowerShellAssemblyLoadContext being initialized with empty basePaths

Author: mariuselixCreated Sep 8, 2026Updated Sep 16, 2026
LabelsIssue-BugNeeds-Triage

Prerequisites

Steps to reproduce

When running some PowerShell command that needs System.IO.Pipelines remotely (so via wsmprovhost.exe), it fails with a FileNotFoundException, because the file could not be located & loaded into the default ALC (Assembly Load Context). Of course, this could happen with other modules as well.

The file does exist & is in the right place, correct version.

The problem seems to be that the ALC is initialized with string.Empty for basePaths and also specifically System.IO.Pipelines is missing from TRUSTED_PLATFORM_ASSEMBLIES list (raised a separate issue item for that -> https://github.com/PowerShell/PowerShell-Native/issues/114). https://github.com/PowerShell/PowerShell/blob/b664c2e026d1610e9b5a6cc5b14d3c86aae9ab81/src/System.Management.Automation/utils/ClrFacade.cs#L41 https://github.com/PowerShell/PowerShell/blob/b664c2e026d1610e9b5a6cc5b14d3c86aae9ab81/src/System.Management.Automation/engine/hostifaces/ConnectionBase.cs#L46 https://github.com/PowerShell/PowerShell/blob/b664c2e026d1610e9b5a6cc5b14d3c86aae9ab81/src/System.Management.Automation/CoreCLR/CorePsAssemblyLoadContext.cs#L589

e.g:

PS C:\> Invoke-Command -ComputerName  srv-2025.skynet.lab -ConfigurationName powershell.7 -ScriptBlock {
     
     # We need to run something to trigger the loading of System.IO.Pipelines. Interacting with a repository using v3 APIs will trigger it while parsing the JSON (e.g: nuget.org).
     Find-PSResource -Name Newtonsoft.Json -Repository NuGet -Verbose
}

Find-PSResource: Could not load file or assembly 'System.IO.Pipelines, Version=10.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified.

Some useful debugging information:

2068206b0e8(System.Management.Automation.PowerShellAssemblyLoadContext)._probingPaths
[raw] 00000206820239d8 System.String[] Length: 0

Run this locally & remotely to confirm:

[pscustomobject]@{
    ProcessPath = [Environment]::ProcessPath
    BaseDirectory = [AppContext]::BaseDirectory
    DepsFiles = [AppContext]::GetData('APP_CONTEXT_DEPS_FILES')
    HasPipelinesInTPA = (
        [AppContext]::GetData('TRUSTED_PLATFORM_ASSEMBLIES') -split ';'
    ).Where({ [IO.Path]::GetFileName($_) -eq 'System.IO.Pipelines.dll' }).Count -gt 0
}

LOCAL:

ProcessPath : C:\Program Files\PowerShell\7\pwsh.exe 
BaseDirectory : C:\Program Files\PowerShell\7\
DepsFile : C:\Program Files\PowerShell\7\pwsh.deps.json   
HasPipelinesInTPA : True

REMOTE:

ProcessPath : C:\Windows\system32\wsmprovhost.exe
BaseDirectory :
DepsFiles :
HasPipelinesInTPA : False
PSComputerName : srv-2025.skynet.lab

This is the flow that leads to the problem: -> PSResourceGet V3ServerAPICalls -> System.Text.Json loaded to parse .json response -> PooledByteBufferWriter from System.Text.Json has a dependency (extends) on PipeWriter, which is coming from System.IO.Pipelines -> bind System.IO.Pipelines v10.0.0.0 — token cc7b13ffcd2ddd51 -> not in ALC already -> empty basePaths / __probingPaths -> not in TRUSTED_PLATFORM_ASSEMBLIES -> fallback as last resort to legacy GAC / MSIL (not found there either, but not expected to be there anyway) -> FileNotFoundException

If you manually import the module in the ALC, before running the command, it all works fine. e.g:

Invoke-Command -ComputerName srv-2025.skynet.lab -ConfigurationName powershell.7 -ScriptBlock {
 
     [System.Runtime.Loader.AssemblyLoadContext]::Default.LoadFromAssemblyPath((Join-Path $PSHOME 'System.IO.Pipelines.dll'))

      # We need to run something to trigger the loading of System.IO.Pipelines. Interacting with a repository using v3 APIs will trigger it while parsing the JSON (e.g: nuget.org).
      Find-PSResource -Name Newtonsoft.Json -Repository NuGetV3Lab
}


GAC    Version        Location                                         PSComputerName
---    -------        --------                                         --------------
False  v4.0.30319     C:\Program Files\PowerShell\7\System.IO.Pipelin… srv-2025.skynet.lab

Author                   : James Newton-King
...
Name                     : Newtonsoft.Json
ProjectUri               : https://www.newtonsoft.com/json
...

Expected behavior

The ALC loads System.IO.Pipelines & the command runs successfully.

Actual behavior

Find-PSResource: Could not load file or assembly 'System.IO.Pipelines, Version=10.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified.

Error details

OriginInfo            :  srv-2025.skynet.lab
Exception             :
    Type                           : System.Management.Automation.RemoteException
    SerializedRemoteException      : System.IO.FileNotFoundException: Could not load file or assembly
'System.IO.Pipelines, Version=10.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the
file specified.
                                     File name: 'System.IO.Pipelines, Version=10.0.0.0, Culture=neutral,
PublicKeyToken=cc7b13ffcd2ddd51'
                                     at System.Text.Json.JsonDocument.Dispose()
                                     at
Microsoft.PowerShell.PSResourceGet.Cmdlets.V3ServerAPICalls.GetJsonElementArr(String request, String propertyName,
Int32& totalHits, ErrorRecord& errRecord) in C:\__w\1\s\PSResourceGet\src\code\V3ServerAPICalls.cs:line 1528
                                     at
Microsoft.PowerShell.PSResourceGet.Cmdlets.V3ServerAPICalls.GetJsonElementArr(String request, String propertyName,
Int32& totalHits, ErrorRecord& errRecord) in C:\__w\1\s\PSResourceGet\src\code\V3ServerAPICalls.cs:line 1498
    SerializedRemoteInvocationInfo : System.Management.Automation.InvocationInfo
    ErrorRecord                    :
        Exception             :
            Type                           : System.Management.Automation.RemoteException
            SerializedRemoteException      : System.IO.FileNotFoundException: Could not load file or assembly
'System.IO.Pipelines, Version=10.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the
file specified.
                                             File name: 'System.IO.Pipelines, Version=10.0.0.0, Culture=neutral,
PublicKeyToken=cc7b13ffcd2ddd51'
                                             at System.Text.Json.JsonDocument.Dispose()
                                             at
Microsoft.PowerShell.PSResourceGet.Cmdlets.V3ServerAPICalls.GetJsonElementArr(String request, String propertyName,
Int32& totalHits, ErrorRecord& errRecord) in C:\__w\1\s\PSResourceGet\src\code\V3ServerAPICalls.cs:line 1528
                                             at
Microsoft.PowerShell.PSResourceGet.Cmdlets.V3ServerAPICalls.GetJsonElementArr(String request, String propertyName,
Int32& totalHits, ErrorRecord& errRecord) in C:\__w\1\s\PSResourceGet\src\code\V3ServerAPICalls.cs:line 1498
            SerializedRemoteInvocationInfo : System.Management.Automation.InvocationInfo
            ErrorRecord                    :
                Exception             :
                    Type                           : System.Management.Automation.RemoteException
                    SerializedRemoteException      : System.IO.FileNotFoundException: Could not load file or assembly
'System.IO.Pipelines, Version=10.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the
file specified.
                                                     File name: 'System.IO.Pipelines, Version=10.0.0.0,
Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'
                                                     at System.Text.Json.JsonDocument.Dispose()
                                                     at
Microsoft.PowerShell.PSResourceGet.Cmdlets.V3ServerAPICalls.GetJsonElementArr(String request, String propertyName,
Int32& totalHits, ErrorRecord& errRecord) in C:\__w\1\s\PSResourceGet\src\code\V3ServerAPICalls.cs:line 1528
                                                     at
Microsoft.PowerShell.PSResourceGet.Cmdlets.V3ServerAPICalls.GetJsonElementArr(String request, String propertyName,
Int32& totalHits, ErrorRecord& errRecord) in C:\__w\1\s\PSResourceGet\src\code\V3ServerAPICalls.cs:line 1498
                    SerializedRemoteInvocationInfo : System.Management.Automation.InvocationInfo
                    ErrorRecord                    :
                        Exception             :
                            Type                           : System.Management.Automation.RemoteException
                            SerializedRemoteException      : System.IO.FileNotFoundException: Could not load file or
assembly 'System.IO.Pipelines, Version=10.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot
find the file specified.
                                                             File name: 'System.IO.Pipelines, Version=10.0.0.0,
Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'
                                                             at System.Text.Json.JsonDocument.Dispose()
                                                             at
Microsoft.PowerShell.PSResourceGet.Cmdlets.V3ServerAPICalls.GetJsonElementArr(String request, String propertyName,
Int32& totalHits, ErrorRecord& errRecord) in C:\__w\1\s\PSResourceGet\src\code\V3ServerAPICalls.cs:line 1528
                                                             at
Microsoft.PowerShell.PSResourceGet.Cmdlets.V3ServerAPICalls.GetJsonElementArr(String request, String propertyName,
Int32& totalHits, ErrorRecord& errRecord) in C:\__w\1\s\PSResourceGet\src\code\V3ServerAPICalls.cs:line 1498
                            SerializedRemoteInvocationInfo : System.Management.Automation.InvocationInfo
                            ErrorRecord                    :
                                Exception             :
                                    Type                           : System.Management.Automation.RemoteException
                                    SerializedRemoteException      : System.IO.FileNotFoundException: Could not load
file or assembly 'System.IO.Pipelines, Version=10.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system
cannot find the file specified.
                                                                     File name: 'System.IO.Pipelines,
Version=10.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'
                                                                     at System.Text.Json.JsonDocument.Dispose()
                                                                     at
Microsoft.PowerShell.PSResourceGet.Cmdlets.V3ServerAPICalls.GetJsonElementArr(String request, String propertyName,
Int32& totalHits, ErrorRecord& errRecord) in C:\__w\1\s\PSResourceGet\src\code\V3ServerAPICalls.cs:line 1528
                                                                     at
Microsoft.PowerShell.PSResourceGet.Cmdlets.V3ServerAPICalls.GetJsonElementArr(String request, String propertyName,
Int32& totalHits, ErrorRecord& errRecord) in C:\__w\1\s\PSResourceGet\src\code\V3ServerAPICalls.cs:line 1498
                                    SerializedRemoteInvocationInfo : System.Management.Automation.InvocationInfo
                                    ErrorRecord                    : …
                                    Message                        : Could not load file or assembly
'System.IO.Pipelines, Version=10.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the
file specified.
                                    HResult                        : -2146233087
                                TargetObject          : Microsoft.PowerShell.PSResourceGet.Cmdlets.V3ServerAPICalls
                                CategoryInfo          : InvalidResult:
(Microsoft.PowerShel…ts.V3ServerAPICalls:V3ServerAPICalls) [Find-PSResource], FileNotFoundException
                                FullyQualifiedErrorId :
GetResponsesFromRegistrationsResourceFailure,Microsoft.PowerShell.PSResourceGet.Cmdlets.FindPSResource
                                ScriptStackTrace      : at <ScriptBlock>, <No file>: line 32
                            Message                        : Could not load file or assembly 'System.IO.Pipelines,
Version=10.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified.
                            HResult                        : -2146233087
                        TargetObject          : Microsoft.PowerShell.PSResourceGet.Cmdlets.V3ServerAPICalls
                        CategoryInfo          : InvalidResult:
(Microsoft.PowerShel…ts.V3ServerAPICalls:V3ServerAPICalls) [Find-PSResource], FileNotFoundException
                        FullyQualifiedErrorId :
GetResponsesFromRegistrationsResourceFailure,Microsoft.PowerShell.PSResourceGet.Cmdlets.FindPSResource
                        ScriptStackTrace      : at <ScriptBlock>, <No file>: line 32
                    Message                        : Could not load file or assembly 'System.IO.Pipelines,
Version=10.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified.
                    HResult                        : -2146233087
                TargetObject          : Microsoft.PowerShell.PSResourceGet.Cmdlets.V3ServerAPICalls
                CategoryInfo          : InvalidResult: (Microsoft.PowerShel…ts.V3ServerAPICalls:V3ServerAPICalls)
[Find-PSResource], FileNotFoundException
                FullyQualifiedErrorId :
GetResponsesFromRegistrationsResourceFailure,Microsoft.PowerShell.PSResourceGet.Cmdlets.FindPSResource
                ScriptStackTrace      : at <ScriptBlock>, <No file>: line 32
            Message                        : Could not load file or assembly 'System.IO.Pipelines, Version=10.0.0.0,
Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified.
            HResult                        : -2146233087
        TargetObject          : Microsoft.PowerShell.PSResourceGet.Cmdlets.V3ServerAPICalls
        CategoryInfo          : InvalidResult: (Microsoft.PowerShel…ts.V3ServerAPICalls:V3ServerAPICalls)
[Find-PSResource], FileNotFoundException
        FullyQualifiedErrorId :
GetResponsesFromRegistrationsResourceFailure,Microsoft.PowerShell.PSResourceGet.Cmdlets.FindPSResource
        ScriptStackTrace      : at <ScriptBlock>, <No file>: line 32
    Message                        : Could not load file or assembly 'System.IO.Pipelines, Version=10.0.0.0,
Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified.
    HResult                        : -2146233087
TargetObject          : Microsoft.PowerShell.PSResourceGet.Cmdlets.V3ServerAPICalls
CategoryInfo          : InvalidResult: (Microsoft.PowerShel…ts.V3ServerAPICalls:V3ServerAPICalls) [Find-PSResource],
FileNotFoundException
FullyQualifiedErrorId :
GetResponsesFromRegistrationsResourceFailure,Microsoft.PowerShell.PSResourceGet.Cmdlets.FindPSResource
ScriptStackTrace      : at <ScriptBlock>, <No file>: line 32

Environment data

$PSVersionTable inserted in the ScriptBlock. I cannot test with PowerShell 7.7 preview, because it does not come with a pwrshplugin.dll & PSSessionConfiguration.

Nevertheless, the problematic code is present in the latest master branch.

Name                           Value
----                           -----
Platform                       Win32NT
PSRemotingProtocolVersion
PSEdition                      Core
OS                             Microsoft Windows 10.0.26100
PSVersion                      7.6.5
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
GitCommitId                    7.6.5
WSManStackVersion              3.0
SerializationVersion           1.1.0.1

Visuals

Failing:

Working, if you manually load the module in the default ALC: