Title: Defining the $ErrorView preference variable in the current scope does not take effect (only in parent scope) · Issue #3645 · PowerShell/PowerShell · GitHub
Open Graph Title: Defining the $ErrorView preference variable in the current scope does not take effect (only in parent scope) · Issue #3645 · PowerShell/PowerShell
X Title: Defining the $ErrorView preference variable in the current scope does not take effect (only in parent scope) · Issue #3645 · PowerShell/PowerShell
Description: Preference variables generally take effect in the scope in which they're defined, which appears not be the case for $ErrorView, which only honors it in an ancestral scope: Steps to reproduce & { Set-Variable -Scope 0 VerbosePreference Co...
Open Graph Description: Preference variables generally take effect in the scope in which they're defined, which appears not be the case for $ErrorView, which only honors it in an ancestral scope: Steps to reproduce & { Se...
X Description: Preference variables generally take effect in the scope in which they're defined, which appears not be the case for $ErrorView, which only honors it in an ancestral scope: Steps to reproduce &a...
Opengraph URL: https://github.com/PowerShell/PowerShell/issues/3645
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Defining the $ErrorView preference variable in the current scope does not take effect (only in parent scope)","articleBody":"Preference variables generally take effect in the scope in which they're defined, which appears not be the case for `$ErrorView`, which only honors it in an ancestral scope:\r\n\r\nSteps to reproduce\r\n------------------\r\n\r\n```powershell\r\n& { Set-Variable -Scope 0 VerbosePreference Continue; Write-Verbose 'I will display.' }\r\n& { Set-Variable -Scope 0 ErrorView CategoryView; Get-Item /NoSuchItem }\r\n& { Set-Variable -Scope 1 ErrorView CategoryView; Get-Item /NoSuchItem }\r\n```\r\n\r\nNote: To re-run the test, start a new session, because the last command sets `$ErrorView` in the global scope.\r\n\r\nExpected behavior\r\n-----------------\r\n\r\n```powershell\r\nI will display.\r\nObjectNotFound: (/NoSuchItem:String) [Get-Item], ItemNotFoundException\r\nObjectNotFound: (/NoSuchItem:String) [Get-Item], ItemNotFoundException\r\n```\r\n\r\nActual behavior\r\n---------------\r\n\r\n```powershell\r\nI will display.\r\nGet-Item : Cannot find path '/NoSuchItem' because it does not exist.\r\nAt line:1 char:54\r\n+ ... t-Variable -Scope 0 ErrorView CategorizedView; Get-Item /NoSuchItem }\r\n+ ~~~~~~~~~~~~~~~~~~~~\r\n + CategoryInfo : ObjectNotFound: (/NoSuchItem:String) [Get-Item], ItemNotFoundException\r\n + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetItemCommand\r\nObjectNotFound: (/NoSuchItem:String) [Get-Item], ItemNotFoundException\r\n```\r\n\r\nSetting `$ErrorView` in the same scope as the failing `Get-Item` command didn't take effect - contrast this with the `$VerbosePreference` variable.\r\n\r\nEnvironment data\r\n----------------\r\n\r\n\u003c!-- provide the output of $PSVersionTable -->\r\n\r\n```powershell\r\nPowerShell Core v6.0.0-alpha (v6.0.0-alpha.18) on Darwin Kernel Version 16.5.0: Fri Mar 3 16:52:33 PST 2017; root:xnu-3789.51.2~3/RELEASE_X86_64\r\n```\r\n","author":{"url":"https://github.com/mklement0","@type":"Person","name":"mklement0"},"datePublished":"2017-04-25T20:10:12Z","url":"https://github.com/PowerShell/PowerShell/issues/3645"}
| 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:be2c6c4b-02f3-a3da-4499-717fe60fa2f7 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | CB50:14BE93:28D68A7:38BD667:6AFD4C66 |
| html-safe-nonce | 89ea768be2a0c220a162a4aa86ee38333a5a2b2fa04d75089511bdd4d4a78d28 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDQjUwOjE0QkU5MzoyOEQ2OEE3OjM4QkQ2Njc6NkFGRDRDNjYiLCJ2aXNpdG9yX2lkIjoiODcwNzA5NjE2NDg0ODk3OTA0NiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 821e03c106a466474a188c37ccc2d2fa098fa7a7a0f96239275a61d1d3b67a9b |
| hovercard-subject-tag | issue:224257597 |
| 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/3645/issue_layout |
| twitter:image | https://opengraph.githubassets.com/59c0272c57c3876644dc150511f923d9fc95cc97adc6d4326169adb38ed0d631/PowerShell/PowerShell/issues/3645 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/59c0272c57c3876644dc150511f923d9fc95cc97adc6d4326169adb38ed0d631/PowerShell/PowerShell/issues/3645 |
| og:image:alt | Preference variables generally take effect in the scope in which they're defined, which appears not be the case for $ErrorView, which only honors it in an ancestral scope: Steps to reproduce & { Se... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | mklement0 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 66653c2e55a6fff2930be1bdf07ee4f8aa137e3956d056c822563be6f878755e |
| 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 | b6f01f7cb9f35f8c09949773241a3d49dd04b340 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width