Title: Remote session (wsmprovhost.exe) cannot resolve assemblies due to PowerShellAssemblyLoadContext being initialized with empty basePaths · Issue #27982 · PowerShell/PowerShell · GitHub
Open Graph Title: Remote session (wsmprovhost.exe) cannot resolve assemblies due to PowerShellAssemblyLoadContext being initialized with empty basePaths · Issue #27982 · PowerShell/PowerShell
X Title: Remote session (wsmprovhost.exe) cannot resolve assemblies due to PowerShellAssemblyLoadContext being initialized with empty basePaths · Issue #27982 · PowerShell/PowerShell
Description: Prerequisites Write a descriptive title. Make sure you are able to repro it on the latest released version Search the existing issues. Refer to the FAQ. Refer to Differences between Windows PowerShell 5.1 and PowerShell. Steps to reprodu...
Open Graph Description: Prerequisites Write a descriptive title. Make sure you are able to repro it on the latest released version Search the existing issues. Refer to the FAQ. Refer to Differences between Windows PowerSh...
X Description: Prerequisites Write a descriptive title. Make sure you are able to repro it on the latest released version Search the existing issues. Refer to the FAQ. Refer to Differences between Windows PowerSh...
Opengraph URL: https://github.com/PowerShell/PowerShell/issues/27982
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Remote session (wsmprovhost.exe) cannot resolve assemblies due to PowerShellAssemblyLoadContext being initialized with empty basePaths","articleBody":"### Prerequisites\n\n- [x] Write a descriptive title.\n- [x] Make sure you are able to repro it on the [latest released version](https://github.com/PowerShell/PowerShell/releases)\n- [x] Search the existing issues.\n- [x] Refer to the [FAQ](https://github.com/PowerShell/PowerShell/blob/master/docs/FAQ.md).\n- [x] Refer to [Differences between Windows PowerShell 5.1 and PowerShell](https://learn.microsoft.com/powershell/scripting/whats-new/differences-from-windows-powershell).\n\n### Steps to reproduce\n\nWhen 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.\n\n**The file does exist & is in the right place, correct version.**\n\nThe 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).\nhttps://github.com/PowerShell/PowerShell/blob/b664c2e026d1610e9b5a6cc5b14d3c86aae9ab81/src/System.Management.Automation/utils/ClrFacade.cs#L41\nhttps://github.com/PowerShell/PowerShell/blob/b664c2e026d1610e9b5a6cc5b14d3c86aae9ab81/src/System.Management.Automation/engine/hostifaces/ConnectionBase.cs#L46\nhttps://github.com/PowerShell/PowerShell/blob/b664c2e026d1610e9b5a6cc5b14d3c86aae9ab81/src/System.Management.Automation/CoreCLR/CorePsAssemblyLoadContext.cs#L589\n\ne.g:\n```powershell\nPS C:\\> Invoke-Command -ComputerName srv-2025.skynet.lab -ConfigurationName powershell.7 -ScriptBlock {\n \n # 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).\n Find-PSResource -Name Newtonsoft.Json -Repository NuGet -Verbose\n}\n\nFind-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.\n```\n\nSome useful debugging information:\n```\n2068206b0e8(System.Management.Automation.PowerShellAssemblyLoadContext)._probingPaths\n[raw] 00000206820239d8 System.String[] Length: 0\n```\n\nRun this locally & remotely to confirm:\n```powershell\n[pscustomobject]@{\n ProcessPath = [Environment]::ProcessPath\n BaseDirectory = [AppContext]::BaseDirectory\n DepsFiles = [AppContext]::GetData('APP_CONTEXT_DEPS_FILES')\n HasPipelinesInTPA = (\n [AppContext]::GetData('TRUSTED_PLATFORM_ASSEMBLIES') -split ';'\n ).Where({ [IO.Path]::GetFileName($_) -eq 'System.IO.Pipelines.dll' }).Count -gt 0\n}\n```\n\nLOCAL:\n```powershell\nProcessPath : C:\\Program Files\\PowerShell\\7\\pwsh.exe \nBaseDirectory : C:\\Program Files\\PowerShell\\7\\\nDepsFile : C:\\Program Files\\PowerShell\\7\\pwsh.deps.json \nHasPipelinesInTPA : True\n```\n\nREMOTE:\n```powershell\nProcessPath : C:\\Windows\\system32\\wsmprovhost.exe\nBaseDirectory :\nDepsFiles :\nHasPipelinesInTPA : False\nPSComputerName : srv-2025.skynet.lab\n```\n\nThis is the flow that leads to the problem:\n -> `PSResourceGet `V3ServerAPICalls\n -> `System.Text.Json` loaded to parse .json response\n -> [PooledByteBufferWriter](https://relativityapiexplorer.azurewebsites.net/packages/System.Text.Json/10.0.11/lib/net10.0/System.Text.Json.dll/System.Text.Json/PooledByteBufferWriter?code=true) from `System.Text.Json` has a dependency (extends) on [PipeWriter](https://learn.microsoft.com/en-us/dotnet/api/system.io.pipelines.pipewriter?view=net-10.0), which is coming from `System.IO.Pipelines`\n -> bind `System.IO.Pipelines` v10.0.0.0 — token cc7b13ffcd2ddd51\n -> not in ALC already\n -> empty `basePaths` / `__probingPaths`\n -> not in `TRUSTED_PLATFORM_ASSEMBLIES`\n -> fallback as last resort to legacy GAC / MSIL (not found there either, but not expected to be there anyway)\n -> `FileNotFoundException`\n\nIf you manually import the module in the ALC, before running the command, it all works fine.\ne.g:\n```powershell\nInvoke-Command -ComputerName srv-2025.skynet.lab -ConfigurationName powershell.7 -ScriptBlock {\n \n [System.Runtime.Loader.AssemblyLoadContext]::Default.LoadFromAssemblyPath((Join-Path $PSHOME 'System.IO.Pipelines.dll'))\n\n # 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).\n Find-PSResource -Name Newtonsoft.Json -Repository NuGetV3Lab\n}\n\n\nGAC Version Location PSComputerName\n--- ------- -------- --------------\nFalse v4.0.30319 C:\\Program Files\\PowerShell\\7\\System.IO.Pipelin… srv-2025.skynet.lab\n\nAuthor : James Newton-King\n...\nName : Newtonsoft.Json\nProjectUri : https://www.newtonsoft.com/json\n...\n```\n\n\n### Expected behavior\n\nThe ALC loads System.IO.Pipelines & the command runs successfully.\n\n\n### Actual behavior\n\n```powershell\nFind-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.\n```\n\n### Error details\n\n```console\nOriginInfo : srv-2025.skynet.lab\nException :\n Type : System.Management.Automation.RemoteException\n SerializedRemoteException : System.IO.FileNotFoundException: Could not load file or assembly\n'System.IO.Pipelines, Version=10.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the\nfile specified.\n File name: 'System.IO.Pipelines, Version=10.0.0.0, Culture=neutral,\nPublicKeyToken=cc7b13ffcd2ddd51'\n at System.Text.Json.JsonDocument.Dispose()\n at\nMicrosoft.PowerShell.PSResourceGet.Cmdlets.V3ServerAPICalls.GetJsonElementArr(String request, String propertyName,\nInt32& totalHits, ErrorRecord& errRecord) in C:\\__w\\1\\s\\PSResourceGet\\src\\code\\V3ServerAPICalls.cs:line 1528\n at\nMicrosoft.PowerShell.PSResourceGet.Cmdlets.V3ServerAPICalls.GetJsonElementArr(String request, String propertyName,\nInt32& totalHits, ErrorRecord& errRecord) in C:\\__w\\1\\s\\PSResourceGet\\src\\code\\V3ServerAPICalls.cs:line 1498\n SerializedRemoteInvocationInfo : System.Management.Automation.InvocationInfo\n ErrorRecord :\n Exception :\n Type : System.Management.Automation.RemoteException\n SerializedRemoteException : System.IO.FileNotFoundException: Could not load file or assembly\n'System.IO.Pipelines, Version=10.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the\nfile specified.\n File name: 'System.IO.Pipelines, Version=10.0.0.0, Culture=neutral,\nPublicKeyToken=cc7b13ffcd2ddd51'\n at System.Text.Json.JsonDocument.Dispose()\n at\nMicrosoft.PowerShell.PSResourceGet.Cmdlets.V3ServerAPICalls.GetJsonElementArr(String request, String propertyName,\nInt32& totalHits, ErrorRecord& errRecord) in C:\\__w\\1\\s\\PSResourceGet\\src\\code\\V3ServerAPICalls.cs:line 1528\n at\nMicrosoft.PowerShell.PSResourceGet.Cmdlets.V3ServerAPICalls.GetJsonElementArr(String request, String propertyName,\nInt32& totalHits, ErrorRecord& errRecord) in C:\\__w\\1\\s\\PSResourceGet\\src\\code\\V3ServerAPICalls.cs:line 1498\n SerializedRemoteInvocationInfo : System.Management.Automation.InvocationInfo\n ErrorRecord :\n Exception :\n Type : System.Management.Automation.RemoteException\n SerializedRemoteException : System.IO.FileNotFoundException: Could not load file or assembly\n'System.IO.Pipelines, Version=10.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the\nfile specified.\n File name: 'System.IO.Pipelines, Version=10.0.0.0,\nCulture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'\n at System.Text.Json.JsonDocument.Dispose()\n at\nMicrosoft.PowerShell.PSResourceGet.Cmdlets.V3ServerAPICalls.GetJsonElementArr(String request, String propertyName,\nInt32& totalHits, ErrorRecord& errRecord) in C:\\__w\\1\\s\\PSResourceGet\\src\\code\\V3ServerAPICalls.cs:line 1528\n at\nMicrosoft.PowerShell.PSResourceGet.Cmdlets.V3ServerAPICalls.GetJsonElementArr(String request, String propertyName,\nInt32& totalHits, ErrorRecord& errRecord) in C:\\__w\\1\\s\\PSResourceGet\\src\\code\\V3ServerAPICalls.cs:line 1498\n SerializedRemoteInvocationInfo : System.Management.Automation.InvocationInfo\n ErrorRecord :\n Exception :\n Type : System.Management.Automation.RemoteException\n SerializedRemoteException : System.IO.FileNotFoundException: Could not load file or\nassembly 'System.IO.Pipelines, Version=10.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot\nfind the file specified.\n File name: 'System.IO.Pipelines, Version=10.0.0.0,\nCulture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'\n at System.Text.Json.JsonDocument.Dispose()\n at\nMicrosoft.PowerShell.PSResourceGet.Cmdlets.V3ServerAPICalls.GetJsonElementArr(String request, String propertyName,\nInt32& totalHits, ErrorRecord& errRecord) in C:\\__w\\1\\s\\PSResourceGet\\src\\code\\V3ServerAPICalls.cs:line 1528\n at\nMicrosoft.PowerShell.PSResourceGet.Cmdlets.V3ServerAPICalls.GetJsonElementArr(String request, String propertyName,\nInt32& totalHits, ErrorRecord& errRecord) in C:\\__w\\1\\s\\PSResourceGet\\src\\code\\V3ServerAPICalls.cs:line 1498\n SerializedRemoteInvocationInfo : System.Management.Automation.InvocationInfo\n ErrorRecord :\n Exception :\n Type : System.Management.Automation.RemoteException\n SerializedRemoteException : System.IO.FileNotFoundException: Could not load\nfile or assembly 'System.IO.Pipelines, Version=10.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system\ncannot find the file specified.\n File name: 'System.IO.Pipelines,\nVersion=10.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'\n at System.Text.Json.JsonDocument.Dispose()\n at\nMicrosoft.PowerShell.PSResourceGet.Cmdlets.V3ServerAPICalls.GetJsonElementArr(String request, String propertyName,\nInt32& totalHits, ErrorRecord& errRecord) in C:\\__w\\1\\s\\PSResourceGet\\src\\code\\V3ServerAPICalls.cs:line 1528\n at\nMicrosoft.PowerShell.PSResourceGet.Cmdlets.V3ServerAPICalls.GetJsonElementArr(String request, String propertyName,\nInt32& totalHits, ErrorRecord& errRecord) in C:\\__w\\1\\s\\PSResourceGet\\src\\code\\V3ServerAPICalls.cs:line 1498\n SerializedRemoteInvocationInfo : System.Management.Automation.InvocationInfo\n ErrorRecord : …\n Message : Could not load file or assembly\n'System.IO.Pipelines, Version=10.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the\nfile specified.\n HResult : -2146233087\n TargetObject : Microsoft.PowerShell.PSResourceGet.Cmdlets.V3ServerAPICalls\n CategoryInfo : InvalidResult:\n(Microsoft.PowerShel…ts.V3ServerAPICalls:V3ServerAPICalls) [Find-PSResource], FileNotFoundException\n FullyQualifiedErrorId :\nGetResponsesFromRegistrationsResourceFailure,Microsoft.PowerShell.PSResourceGet.Cmdlets.FindPSResource\n ScriptStackTrace : at \u003cScriptBlock>, \u003cNo file>: line 32\n Message : Could not load file or assembly 'System.IO.Pipelines,\nVersion=10.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified.\n HResult : -2146233087\n TargetObject : Microsoft.PowerShell.PSResourceGet.Cmdlets.V3ServerAPICalls\n CategoryInfo : InvalidResult:\n(Microsoft.PowerShel…ts.V3ServerAPICalls:V3ServerAPICalls) [Find-PSResource], FileNotFoundException\n FullyQualifiedErrorId :\nGetResponsesFromRegistrationsResourceFailure,Microsoft.PowerShell.PSResourceGet.Cmdlets.FindPSResource\n ScriptStackTrace : at \u003cScriptBlock>, \u003cNo file>: line 32\n Message : Could not load file or assembly 'System.IO.Pipelines,\nVersion=10.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified.\n HResult : -2146233087\n TargetObject : Microsoft.PowerShell.PSResourceGet.Cmdlets.V3ServerAPICalls\n CategoryInfo : InvalidResult: (Microsoft.PowerShel…ts.V3ServerAPICalls:V3ServerAPICalls)\n[Find-PSResource], FileNotFoundException\n FullyQualifiedErrorId :\nGetResponsesFromRegistrationsResourceFailure,Microsoft.PowerShell.PSResourceGet.Cmdlets.FindPSResource\n ScriptStackTrace : at \u003cScriptBlock>, \u003cNo file>: line 32\n Message : Could not load file or assembly 'System.IO.Pipelines, Version=10.0.0.0,\nCulture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified.\n HResult : -2146233087\n TargetObject : Microsoft.PowerShell.PSResourceGet.Cmdlets.V3ServerAPICalls\n CategoryInfo : InvalidResult: (Microsoft.PowerShel…ts.V3ServerAPICalls:V3ServerAPICalls)\n[Find-PSResource], FileNotFoundException\n FullyQualifiedErrorId :\nGetResponsesFromRegistrationsResourceFailure,Microsoft.PowerShell.PSResourceGet.Cmdlets.FindPSResource\n ScriptStackTrace : at \u003cScriptBlock>, \u003cNo file>: line 32\n Message : Could not load file or assembly 'System.IO.Pipelines, Version=10.0.0.0,\nCulture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified.\n HResult : -2146233087\nTargetObject : Microsoft.PowerShell.PSResourceGet.Cmdlets.V3ServerAPICalls\nCategoryInfo : InvalidResult: (Microsoft.PowerShel…ts.V3ServerAPICalls:V3ServerAPICalls) [Find-PSResource],\nFileNotFoundException\nFullyQualifiedErrorId :\nGetResponsesFromRegistrationsResourceFailure,Microsoft.PowerShell.PSResourceGet.Cmdlets.FindPSResource\nScriptStackTrace : at \u003cScriptBlock>, \u003cNo file>: line 32\n```\n\n### Environment data\n\n$PSVersionTable inserted in the ScriptBlock. I cannot test with PowerShell 7.7 preview, because it does not come with a pwrshplugin.dll & PSSessionConfiguration.\n\nNevertheless, the problematic code is present in the latest master branch.\n\n```powershell\nName Value\n---- -----\nPlatform Win32NT\nPSRemotingProtocolVersion\nPSEdition Core\nOS Microsoft Windows 10.0.26100\nPSVersion 7.6.5\nPSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}\nGitCommitId 7.6.5\nWSManStackVersion 3.0\nSerializationVersion 1.1.0.1\n```\n\n### Visuals\n\nFailing:\n\u003cimg width=\"1054\" height=\"133\" alt=\"Image\" src=\"https://github.com/user-attachments/assets/30570099-3377-45d9-9b6a-77b73f347439\" />\n\nWorking, if you manually load the module in the default ALC:\n\u003cimg width=\"1051\" height=\"291\" alt=\"Image\" src=\"https://github.com/user-attachments/assets/1063b7bf-593f-4adb-852d-23af7fa7d7d7\" />","author":{"url":"https://github.com/mariuselix","@type":"Person","name":"mariuselix"},"datePublished":"2026-09-08T11:51:45Z","url":"https://github.com/PowerShell/PowerShell/issues/27982"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:05b84d78-7765-024a-c2ed-0887e477c7ba |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C3DC:9A536:1AD12F5:25A18C0:6AFD0AC9 |
| html-safe-nonce | bfae8f7aad43fc9f38b9945835883840b5240264799856d376279c9576a9ed82 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDM0RDOjlBNTM2OjFBRDEyRjU6MjVBMThDMDo2QUZEMEFDOSIsInZpc2l0b3JfaWQiOiI0NzQ5ODU0NzY1OTQ3MzU3ODk3IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 7c4104431b970bc378547129a48a4a7c0c88a65702cea407689266f8f6f7340b |
| hovercard-subject-tag | issue:5386337529 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/PowerShell/PowerShell/27982/issue_layout |
| twitter:image | https://opengraph.githubassets.com/0a21add14074aca44dbcdb249193b60e81aedb72af22b6171343cc55ed819981/PowerShell/PowerShell/issues/27982 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/0a21add14074aca44dbcdb249193b60e81aedb72af22b6171343cc55ed819981/PowerShell/PowerShell/issues/27982 |
| og:image:alt | Prerequisites Write a descriptive title. Make sure you are able to repro it on the latest released version Search the existing issues. Refer to the FAQ. Refer to Differences between Windows PowerSh... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | mariuselix |
| hostname | github.com |
| expected-hostname | github.com |
| None | b29de2abb97b6307b16270785efeb58b51a117d5a9b659acf00b77aa00e7043b |
| turbo-cache-control | no-preview |
| go-import | github.com/PowerShell/PowerShell git https://github.com/PowerShell/PowerShell.git |
| octolytics-dimension-user_id | 11524380 |
| octolytics-dimension-user_login | PowerShell |
| octolytics-dimension-repository_id | 49609581 |
| octolytics-dimension-repository_nwo | PowerShell/PowerShell |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 49609581 |
| octolytics-dimension-repository_network_root_nwo | PowerShell/PowerShell |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 8c9e619def6d670dc18a45d3b02cea938c1c7e47 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width