Title: ConvertFrom-Json does not respect -ErrorAction · Issue #2860 · PowerShell/PowerShell · GitHub
Open Graph Title: ConvertFrom-Json does not respect -ErrorAction · Issue #2860 · PowerShell/PowerShell
X Title: ConvertFrom-Json does not respect -ErrorAction · Issue #2860 · PowerShell/PowerShell
Description: Steps to reproduce Run the following expressions: "some invalid JSON string" | ConvertFrom-Json -ErrorAction Ignore "some invalid JSON string" | ConvertFrom-Json -ErrorAction SilentlyContinue Expected behavior Both expressions write no e...
Open Graph Description: Steps to reproduce Run the following expressions: "some invalid JSON string" | ConvertFrom-Json -ErrorAction Ignore "some invalid JSON string" | ConvertFrom-Json -ErrorAction SilentlyContinue Expec...
X Description: Steps to reproduce Run the following expressions: "some invalid JSON string" | ConvertFrom-Json -ErrorAction Ignore "some invalid JSON string" | ConvertFrom-Json -ErrorAction Si...
Opengraph URL: https://github.com/PowerShell/PowerShell/issues/2860
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"ConvertFrom-Json does not respect -ErrorAction","articleBody":"Steps to reproduce\r\n------------------\r\nRun the following expressions:\r\n\r\n```powershell\r\n\"some invalid JSON string\" | ConvertFrom-Json -ErrorAction Ignore\r\n\"some invalid JSON string\" | ConvertFrom-Json -ErrorAction SilentlyContinue\r\n```\r\n\r\nExpected behavior\r\n-----------------\r\nBoth expressions write no error to the console, and return either `$null` or the empty string.\r\n\r\nActual behavior\r\n---------------\r\nThe expressions write an error to the console and throw the following exception:\r\n\r\n```\r\nConvertFrom-Json : Invalid JSON primitive: some invalid JSON string.\r\nAt line:1 char:12\r\n+ \"some invalid JSON string\" | ConvertFrom-Json -ErrorAction Ignore\r\n+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\n + CategoryInfo : NotSpecified: (:) [ConvertFrom-Json], ArgumentException\r\n + FullyQualifiedErrorId : System.ArgumentException,Microsoft.PowerShell.Commands.ConvertFromJsonCommand\r\n```\r\n\r\nEnvironment data\r\n----------------\r\n\r\n```powershell\r\n> $PSVersionTable\r\n\r\nName Value\r\n---- -----\r\nPSVersion 5.1.14393.206\r\nPSEdition Desktop\r\nPSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}\r\nBuildVersion 10.0.14393.206\r\nCLRVersion 4.0.30319.42000\r\nWSManStackVersion 3.0\r\nPSRemotingProtocolVersion 2.3\r\nSerializationVersion 1.1.0.1\r\n```\r\n","author":{"url":"https://github.com/alastairs","@type":"Person","name":"alastairs"},"datePublished":"2016-12-08T17:37:30Z","url":"https://github.com/PowerShell/PowerShell/issues/2860"}
| 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:1c2fdd00-7ff5-ab0c-d033-7aa931266a55 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C2D8:201FB3:2D864D:3E83D9:6AFD5595 |
| html-safe-nonce | ef62b3e79df9766012d01521db69e263cdb92d82fba624754eb1b448befc07c8 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDMkQ4OjIwMUZCMzoyRDg2NEQ6M0U4M0Q5OjZBRkQ1NTk1IiwidmlzaXRvcl9pZCI6IjU2Njg4NTE4Njg5MTUwMjkzOTciLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 530c8964fe2efc72c8bbadd93bf2667bc4a9084005d10999a012b29bd1f776bc |
| hovercard-subject-tag | issue:194398298 |
| 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/2860/issue_layout |
| twitter:image | https://opengraph.githubassets.com/aa3b1cfc5a47d734eaf5e17e08e58acfb5ada3b5fe0b5494e90ff17636dbeb0a/PowerShell/PowerShell/issues/2860 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/aa3b1cfc5a47d734eaf5e17e08e58acfb5ada3b5fe0b5494e90ff17636dbeb0a/PowerShell/PowerShell/issues/2860 |
| og:image:alt | Steps to reproduce Run the following expressions: "some invalid JSON string" | ConvertFrom-Json -ErrorAction Ignore "some invalid JSON string" | ConvertFrom-Json -ErrorAction SilentlyContinue Expec... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | alastairs |
| 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