Title: Start-Job fails on PowerShell 7.2.0 when installed as a .NET global tool · Issue #16537 · PowerShell/PowerShell · GitHub
Open Graph Title: Start-Job fails on PowerShell 7.2.0 when installed as a .NET global tool · Issue #16537 · PowerShell/PowerShell
X Title: Start-Job fails on PowerShell 7.2.0 when installed as a .NET global tool · Issue #16537 · 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/16537
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Start-Job fails on PowerShell 7.2.0 when installed as a .NET global tool","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://docs.microsoft.com/powershell/scripting/whats-new/differences-from-windows-powershell).\n\n### Steps to reproduce\n\nUse this script:\r\n```powershell\r\nSet-StrictMode -Version 3.0\r\n$ErrorActionPreference = \"Stop\"\r\n\r\n$job = Start-Job -ScriptBlock { Write-Host \"I am a job.\" }\r\nWait-Job -Job $job | Out-Null\r\nReceive-Job -Job $job\r\n```\r\n\r\n✔️ When using PowerShell 7.1.5 as a .NET global tool, the script runs successfully. \r\n✔ When using PowerShell 7.2.0 from the MSI installer, the script runs successfully.\r\n❌ When using PowerShell 7.2.0 as a .NET global tool, the script fails.\r\n\r\nThe error is:\r\n```\r\nThe pwsh executable cannot be found at\r\n | \"C:\\Users\\\u003cusername>\\.dotnet\\tools\\.store\\powershell\\7.2.0\\powershell\\7.2.0\\tools\\net6.0\\any\\win\\pwsh.exe\"\r\n```\r\nIt's true that the file does not exist:\r\n```\r\n> get-childitem *pwsh*\r\n\r\n Directory: C:\\Users\\\u003cusername>\\.dotnet\\tools\\.store\\powershell\\7.2.0\\powershell\\7.2.0\\tools\\net6.0\\any\\win\r\n\r\nMode LastWriteTime Length Name\r\n---- ------------- ------ ----\r\n-a--- 2/11/2021 09:04 100424 pwsh.deps.json\r\n-a--- 2/11/2021 09:10 143736 pwsh.dll\r\n-a--- 2/11/2021 09:04 583 pwsh.runtimeconfig.json\r\n```\r\n\r\nUsing PowerShell 7.1.5, that directory also contains `pwsh.exe`. That file is missing in PowerShell 7.2.0.\n\n### Expected behavior\n\n```console\n> pwsh .\\test.ps1\r\nI am a job\n```\n\n\n### Actual behavior\n\n```console\n> pwsh .\\test.ps1\r\nStart-Job: D:\\test.ps1:4\r\nLine |\r\n 4 | $job = Start-Job -ScriptBlock { Write-Host \"I am a job.\" }\r\n | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\n | The pwsh executable cannot be found at\r\n | \"C:\\Users\\\u003cusername>\\.dotnet\\tools\\.store\\powershell\\7.2.0\\powershell\\7.2.0\\tools\\net6.0\\any\\win\\pwsh.exe\". Note that 'Start-Job' is not supported by design in scenarios where PowerShell is being hosted in other applications. Instead, usage of the 'ThreadJob' module is recommended in such scenarios.\n```\n\n\n### Error details\n\n```console\nType : System.Management.Automation.CmdletInvocationException\r\nErrorRecord :\r\n Exception :\r\n Type : System.Management.Automation.PSNotSupportedException\r\n ErrorRecord :\r\n Exception :\r\n Type : System.Management.Automation.ParentContainsErrorRecordException\r\n Message : The pwsh executable cannot be found at \"C:\\Users\\\u003cusername>\\.dotnet\\tools\\.sto\r\nre\\powershell\\7.2.0\\powershell\\7.2.0\\tools\\net6.0\\any\\win\\pwsh.exe\".\r\n Note that 'Start-Job' is not supported by design in scenarios where PowerShell is being\r\nhosted in other applications. Instead, usage of the 'ThreadJob' module is recommended in such scenarios.\r\n HResult : -2146233087\r\n CategoryInfo : NotImplemented: (:) [], ParentContainsErrorRecordException\r\n FullyQualifiedErrorId : NotSupported\r\n TargetSite :\r\n Name : ThrowTerminatingError\r\n DeclaringType : System.Management.Automation.MshCommandRuntime, System.Management.Automation,\r\nVersion=7.2.0.500, Culture=neutral, PublicKeyToken=31bf3856ad364e35\r\n MemberType : Method\r\n Module : System.Management.Automation.dll\r\n Message : The pwsh executable cannot be found at \"C:\\Users\\\u003cusername>\\.dotnet\\tools\\.store\\p\r\nowershell\\7.2.0\\powershell\\7.2.0\\tools\\net6.0\\any\\win\\pwsh.exe\".\r\n Note that 'Start-Job' is not supported by design in scenarios where PowerShell is being hosted\r\nin other applications. Instead, usage of the 'ThreadJob' module is recommended in such scenarios.\r\n Source : System.Management.Automation\r\n HResult : -2146233067\r\n StackTrace :\r\n at System.Management.Automation.MshCommandRuntime.ThrowTerminatingError(ErrorRecord errorRecord)\r\n TargetObject :\r\nC:\\Users\\\u003cusername>\\.dotnet\\tools\\.store\\powershell\\7.2.0\\powershell\\7.2.0\\tools\\net6.0\\any\\win\\pwsh.exe\r\n CategoryInfo : NotInstalled: (C:\\Users\\david.bieg….0\\any\\win\\pwsh.exe:String) [Start-Job],\r\nPSNotSupportedException\r\n FullyQualifiedErrorId : IPCPwshExecutableNotFound,Microsoft.PowerShell.Commands.StartJobCommand\r\n InvocationInfo :\r\n MyCommand : Start-Job\r\n ScriptLineNumber : 4\r\n OffsetInLine : 8\r\n HistoryId : 1\r\n ScriptName : D:\\test.ps1\r\n Line : $job = Start-Job -ScriptBlock { Write-Host \"I am a job.\" }\r\n\r\n PositionMessage : At D:\\test.ps1:4 char:8\r\n + $job = Start-Job -ScriptBlock { Write-Host \"I am a job.\" }\r\n + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\n PSScriptRoot : D:\\Code\\Playground\\ps-playground\r\n PSCommandPath : D:\\test.ps1\r\n InvocationName : Start-Job\r\n CommandOrigin : Internal\r\n ScriptStackTrace : at \u003cScriptBlock>, D:\\test.ps1: line 4\r\n at \u003cScriptBlock>, \u003cNo file>: line 1\r\nTargetSite :\r\n Name : Invoke\r\n DeclaringType : System.Management.Automation.Runspaces.PipelineBase, System.Management.Automation,\r\nVersion=7.2.0.500, Culture=neutral, PublicKeyToken=31bf3856ad364e35\r\n MemberType : Method\r\n Module : System.Management.Automation.dll\r\nMessage : The pwsh executable cannot be found at \"C:\\Users\\\u003cusername>\\.dotnet\\tools\\.store\\powers\r\nhell\\7.2.0\\powershell\\7.2.0\\tools\\net6.0\\any\\win\\pwsh.exe\".\r\n Note that 'Start-Job' is not supported by design in scenarios where PowerShell is being hosted in\r\nother applications. Instead, usage of the 'ThreadJob' module is recommended in such scenarios.\r\nData : System.Collections.ListDictionaryInternal\r\nInnerException :\r\n Type : System.Management.Automation.PSNotSupportedException\r\n ErrorRecord :\r\n Exception :\r\n Type : System.Management.Automation.ParentContainsErrorRecordException\r\n Message : The pwsh executable cannot be found at \"C:\\Users\\\u003cusername>\\.dotnet\\tools\\.store\\p\r\nowershell\\7.2.0\\powershell\\7.2.0\\tools\\net6.0\\any\\win\\pwsh.exe\".\r\n Note that 'Start-Job' is not supported by design in scenarios where PowerShell is being hosted\r\nin other applications. Instead, usage of the 'ThreadJob' module is recommended in such scenarios.\r\n HResult : -2146233087\r\n CategoryInfo : NotImplemented: (:) [], ParentContainsErrorRecordException\r\n FullyQualifiedErrorId : NotSupported\r\n TargetSite :\r\n Name : ThrowTerminatingError\r\n DeclaringType : System.Management.Automation.MshCommandRuntime, System.Management.Automation,\r\nVersion=7.2.0.500, Culture=neutral, PublicKeyToken=31bf3856ad364e35\r\n MemberType : Method\r\n Module : System.Management.Automation.dll\r\n Message : The pwsh executable cannot be found at \"C:\\Users\\\u003cusername>\\.dotnet\\tools\\.store\\power\r\nshell\\7.2.0\\powershell\\7.2.0\\tools\\net6.0\\any\\win\\pwsh.exe\".\r\n Note that 'Start-Job' is not supported by design in scenarios where PowerShell is being hosted in\r\nother applications. Instead, usage of the 'ThreadJob' module is recommended in such scenarios.\r\n Source : System.Management.Automation\r\n HResult : -2146233067\r\n StackTrace :\r\n at System.Management.Automation.MshCommandRuntime.ThrowTerminatingError(ErrorRecord errorRecord)\r\nSource : System.Management.Automation\r\nHResult : -2146233087\r\nStackTrace :\r\n at System.Management.Automation.Runspaces.PipelineBase.Invoke(IEnumerable input)\r\n at System.Management.Automation.Runspaces.Pipeline.Invoke()\r\n at Microsoft.PowerShell.Executor.ExecuteCommandHelper(Pipeline tempPipeline, Exception& exceptionThrown,\r\nExecutionOptions options)\n```\n\n\n### Environment data\n\n```powershell\nName Value\r\n---- -----\r\nPSVersion 7.2.0\r\nPSEdition Core\r\nGitCommitId 7.2.0\r\nOS Microsoft Windows 10.0.18363\r\nPlatform Win32NT\r\nPSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}\r\nPSRemotingProtocolVersion 2.3\r\nSerializationVersion 1.1.0.1\r\nWSManStackVersion 3.0\n```\n\n\n### Visuals\n\n_No response_","author":{"url":"https://github.com/reduckted","@type":"Person","name":"reduckted"},"datePublished":"2021-12-02T03:53:17Z","url":"https://github.com/PowerShell/PowerShell/issues/16537"}
| 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:cf970de7-6d8a-5fdf-9918-6f41a1796dfa |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A650:1B6C2:23197:332AF:6AFDD539 |
| html-safe-nonce | a8cc81ae350448537d2100e9afc780a29d733e700d3f7d188b7ce1f766be39f5 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBNjUwOjFCNkMyOjIzMTk3OjMzMkFGOjZBRkRENTM5IiwidmlzaXRvcl9pZCI6IjgxODI4ODQ1ODMwNTQ2MjgxNTMiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 0927edec3d2195733e4a8cb3a4eb936597d2885d45c5fe0b282916299b702de6 |
| hovercard-subject-tag | issue:1069100065 |
| 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/16537/issue_layout |
| twitter:image | https://opengraph.githubassets.com/5cdfba1de1d6e09dd2af1c5697893fcd925e0ffaae933fcaffe4bd9662c28208/PowerShell/PowerShell/issues/16537 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/5cdfba1de1d6e09dd2af1c5697893fcd925e0ffaae933fcaffe4bd9662c28208/PowerShell/PowerShell/issues/16537 |
| 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 | reduckted |
| hostname | github.com |
| expected-hostname | github.com |
| None | 9918bd4004419458bcd838065ac2a76b76ebd11705d73909fff5ab99e996fa23 |
| 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 | a231c174493a6a442c0b0544475c918b30128208 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width