Title: Since 7.4.0, Group-Object cannot group strings containing curly braces · Issue #20711 · PowerShell/PowerShell · GitHub
Open Graph Title: Since 7.4.0, Group-Object cannot group strings containing curly braces · Issue #20711 · PowerShell/PowerShell
X Title: Since 7.4.0, Group-Object cannot group strings containing curly braces · Issue #20711 · 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/20711
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Since 7.4.0, Group-Object cannot group strings containing curly braces","articleBody":"### Prerequisites\r\n\r\n- [X] Write a descriptive title.\r\n- [X] Make sure you are able to repro it on the [latest released version](https://github.com/PowerShell/PowerShell/releases)\r\n- [X] Search the existing issues.\r\n- [X] Refer to the [FAQ](https://github.com/PowerShell/PowerShell/blob/master/docs/FAQ.md).\r\n- [X] Refer to [Differences between Windows PowerShell 5.1 and PowerShell](https://learn.microsoft.com/powershell/scripting/whats-new/differences-from-windows-powershell).\r\n\r\n### Steps to reproduce\r\n\r\nSince 7.4.0, it appears that the `Group-Object` cmdlet tries to interpret its string input as .NET format strings.\r\n\r\nIf a string contains curly braces (U+007B and U+007D), the `Group-Object` cmdlet throws exceptions associated with the `[string]::Format` method or the `-f` operator.\r\n\r\n### Expected behavior\r\n\r\n```console\r\nPS\u003e '{' | Group-Object -NoElement;\r\n\r\nCount Name\r\n----- ----\r\n 1 {\r\n\r\nPS\u003e '}' | Group-Object -NoElement;\r\n\r\nCount Name\r\n----- ----\r\n 1 }\r\n```\r\n\r\n\r\n### Actual behavior\r\n\r\n```console\r\nPS\u003e '{' | Group-Object -NoElement;\r\nGroup-Object: Input string was not in a correct format. Failure to parse near offset 1. Expected an ASCII digit.\r\n\r\nPS\u003e '}' | Group-Object -NoElement;\r\nGroup-Object: Input string was not in a correct format. Failure to parse near offset 1. Unexpected closing brace without a corresponding opening brace.\r\n```\r\n\r\n\r\n### Error details\r\n\r\n```console\r\nException : \r\n Type : System.FormatException\r\n TargetSite : \r\n Name : ThrowFormatInvalidString\r\n DeclaringType : System.ThrowHelper, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e\r\n MemberType : Method\r\n Module : System.Private.CoreLib.dll\r\n Message : Input string was not in a correct format. Failure to parse near offset 1. Unexpected closing brace without a corresponding opening brace.\r\n Source : System.Private.CoreLib\r\n HResult : -2146233033\r\n StackTrace : \r\n at System.Text.StringBuilder.AppendFormatHelper(IFormatProvider provider, String format, ReadOnlySpan`1 args)\r\n at System.Text.StringBuilder.AppendFormat(IFormatProvider provider, String format, Object[] args)\r\n at Microsoft.PowerShell.Commands.GroupInfo.BuildName(List`1 propValues)\r\n at Microsoft.PowerShell.Commands.GroupInfo..ctor(OrderByPropertyEntry groupValue)\r\n at Microsoft.PowerShell.Commands.GroupObjectCommand.DoOrderedGrouping(OrderByPropertyEntry currentObjectEntry, Boolean noElement, List`1 groups, Dictionary`2 groupInfoDictionary, OrderByPropertyComparer orderByPropertyComparer)\r\n at Microsoft.PowerShell.Commands.GroupObjectCommand.EndProcessing()\r\n at System.Management.Automation.CommandProcessorBase.Complete()\r\nCategoryInfo : NotSpecified: (:) [Group-Object], FormatException\r\nFullyQualifiedErrorId : System.FormatException,Microsoft.PowerShell.Commands.GroupObjectCommand\r\nInvocationInfo : \r\n MyCommand : Group-Object\r\n ScriptLineNumber : 1\r\n OffsetInLine : 7\r\n HistoryId : 9\r\n Line : '}' | Group-Object -NoElement;\r\n Statement : Group-Object -NoElement\r\n PositionMessage : At line:1 char:7\r\n + '}' | Group-Object -NoElement;\r\n + ~~~~~~~~~~~~~~~~~~~~~~~\r\n InvocationName : Group-Object\r\n CommandOrigin : Internal\r\nScriptStackTrace : at \u003cScriptBlock\u003e, \u003cNo file\u003e: line 1\r\n```\r\n\r\n\r\n### Environment data\r\n\r\n```powershell\r\nName Value\r\n---- -----\r\nPSVersion 7.4.0\r\nPSEdition Core\r\nGitCommitId 7.4.0\r\nOS Microsoft Windows 10.0.22631\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\r\n```\r\n\r\n\r\n### Visuals\r\n\r\n_No response_","author":{"url":"https://github.com/cschneegans","@type":"Person","name":"cschneegans"},"datePublished":"2023-11-17T02:49:05.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":4},"url":"https://github.com/20711/PowerShell/issues/20711"}
| 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:f4257e45-4f8d-2ce5-3e3c-70c176509d49 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B074:2F1CDA:1B3E05:256192:6A551E1E |
| html-safe-nonce | f4fa49fc1d442694406f6dafe63c0846535c34542897ff445b309157185b0e6e |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCMDc0OjJGMUNEQToxQjNFMDU6MjU2MTkyOjZBNTUxRTFFIiwidmlzaXRvcl9pZCI6Ijc5OTUyOTk3OTA0NDY3MzA3ODIiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 093d99bbfb1af8df60d4450006e7104c6a54887a01e75437750d01be839d5027 |
| hovercard-subject-tag | issue:1998169701 |
| 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/20711/issue_layout |
| twitter:image | https://opengraph.githubassets.com/94e6a9d9a6a957bafd48052940264f279cfaa958576f299e0766263a416d9fff/PowerShell/PowerShell/issues/20711 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/94e6a9d9a6a957bafd48052940264f279cfaa958576f299e0766263a416d9fff/PowerShell/PowerShell/issues/20711 |
| 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 | cschneegans |
| hostname | github.com |
| expected-hostname | github.com |
| None | 682d273eacb2ac51680c6eb9c0b270f029f7ce74c32090f319083c34497e28a5 |
| 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 | 3b6d37c6470adadff4194742daaab9a817cc4980 |
| ui-target | canary-2 |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width