Title: Parser throws with using statement aliases on new lines · Issue #16676 · PowerShell/PowerShell · GitHub
Open Graph Title: Parser throws with using statement aliases on new lines · Issue #16676 · PowerShell/PowerShell
X Title: Parser throws with using statement aliases on new lines · Issue #16676 · 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/16676
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Parser throws with using statement aliases on new lines","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\nType in any of the following lines and add a linebreak after the equals sign:\r\n```\r\nusing namespace whatever =\r\nusing module whatever =\r\nusing type whatever =\r\nusing command whatever =\r\n```\r\nAs soon as you add the new line, PSReadline will display a parser error:\r\n\r\n```\r\nSystem.NullReferenceException: Object reference not set to an instance of an object.\r\n at System.Management.Automation.Language.Parser.ExtentOf(Token first, Ast last)\r\n at System.Management.Automation.Language.Parser.UsingStatementRule(Token usingToken)\r\n at System.Management.Automation.Language.Parser.UsingStatementsRule()\r\n```\r\nThe same thing happens in PowerShell 5.1\n\n### Expected behavior\n\n```console\nNo errors thrown.\n```\n\n\n### Actual behavior\n\n```console\nSystem.NullReferenceException: Object reference not set to an instance of an object.\r\n at System.Management.Automation.Language.Parser.ExtentOf(Token first, Ast last)\r\n at System.Management.Automation.Language.Parser.UsingStatementRule(Token usingToken)\r\n at System.Management.Automation.Language.Parser.UsingStatementsRule()\r\n```\n```\n\n\n### Error details\n\n```console\nPS C:\\Users\\Martin> get-error\r\n\r\nException :\r\n Type : System.Management.Automation.MethodInvocationException\r\n ErrorRecord :\r\n Exception :\r\n Type : System.Management.Automation.ParentContainsErrorRecordException\r\n Message : Exception calling \"ReadLine\" with \"3\" argument(s): \"Unrecoverable error in PowerShell.\"\r\n HResult : -2146233087\r\n CategoryInfo : NotSpecified: (:) [], ParentContainsErrorRecordException\r\n FullyQualifiedErrorId : ParseException\r\n InvocationInfo :\r\n ScriptLineNumber : 7\r\n OffsetInLine : 5\r\n HistoryId : -1\r\n ScriptName : C:\\Users\\Martin\\Documents\\PowerShell\\Modules\\PSReadLine\\2.2.0\\PSReadLine.psm1\r\n Line : [Microsoft.PowerShell.PSConsoleReadLine]::ReadLine($host.Runspace, $ExecutionContext, $lastRunStatus)\r\n\r\n PositionMessage : At C:\\Users\\Martin\\Documents\\PowerShell\\Modules\\PSReadLine\\2.2.0\\PSReadLine.psm1:7 char:5\r\n + [Microsoft.PowerShell.PSConsoleReadLine]::ReadLine($host.Runspace …\r\n + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\n PSScriptRoot : C:\\Users\\Martin\\Documents\\PowerShell\\Modules\\PSReadLine\\2.2.0\r\n PSCommandPath : C:\\Users\\Martin\\Documents\\PowerShell\\Modules\\PSReadLine\\2.2.0\\PSReadLine.psm1\r\n CommandOrigin : Internal\r\n ScriptStackTrace : at PSConsoleHostReadLine, C:\\Users\\Martin\\Documents\\PowerShell\\Modules\\PSReadLine\\2.2.0\\PSReadLine.psm1: line 7\r\n TargetSite :\r\n Name : ConvertToMethodInvocationException\r\n DeclaringType : System.Management.Automation.ExceptionHandlingOps, System.Management.Automation, Version=7.2.0.10, Culture=neutral, PublicKeyToken=31bf3856ad364e35\r\n MemberType : Method\r\n Module : System.Management.Automation.dll\r\n Message : Exception calling \"ReadLine\" with \"3\" argument(s): \"Unrecoverable error in PowerShell.\"\r\n Data : System.Collections.ListDictionaryInternal\r\n InnerException :\r\n Type : System.Management.Automation.ParseException\r\n Message : Unrecoverable error in PowerShell.\r\n ErrorRecord :\r\n Exception :\r\n Type : System.Management.Automation.ParentContainsErrorRecordException\r\n Message : Unrecoverable error in PowerShell.\r\n HResult : -2146233087\r\n CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException\r\n FullyQualifiedErrorId : Parse\r\n TargetSite :\r\n Name : ParseInput\r\n DeclaringType : System.Management.Automation.Language.Parser\r\n MemberType : Method\r\n Module : System.Management.Automation.dll\r\n InnerException :\r\n Type : System.NullReferenceException\r\n TargetSite :\r\n Name : ExtentOf\r\n DeclaringType : System.Management.Automation.Language.Parser\r\n MemberType : Method\r\n Module : System.Management.Automation.dll\r\n Message : Object reference not set to an instance of an object.\r\n Source : System.Management.Automation\r\n HResult : -2147467261\r\n StackTrace :\r\n at System.Management.Automation.Language.Parser.ExtentOf(Token first, Ast last)\r\n at System.Management.Automation.Language.Parser.UsingStatementRule(Token usingToken)\r\n at System.Management.Automation.Language.Parser.UsingStatementsRule()\r\n at System.Management.Automation.Language.Parser.ScriptBlockRule(Token lCurly, Boolean isFilter, StatementAst predefinedStatementAst)\r\n at System.Management.Automation.Language.Parser.ParseTask(String fileName, String input, List`1 tokenList, Boolean recursed, ParseMode parseMode)\r\n at System.Management.Automation.Language.Parser.Parse(String fileName, String input, List`1 tokenList, ParseError[]& errors, ParseMode parseMode)\r\n at System.Management.Automation.Language.Parser.ParseInput(String input, String fileName, Token[]& tokens, ParseError[]& errors)\r\n Source : System.Management.Automation\r\n HResult : -2146233087\r\n StackTrace :\r\n at System.Management.Automation.Language.Parser.ParseInput(String input, String fileName, Token[]& tokens, ParseError[]& errors)\r\n at System.Management.Automation.Language.Parser.ParseInput(String input, Token[]& tokens, ParseError[]& errors)\r\n at Microsoft.PowerShell.PSConsoleReadLine.ParseInput()\r\n at Microsoft.PowerShell.PSConsoleReadLine.GenerateRender(String defaultColor)\r\n at Microsoft.PowerShell.PSConsoleReadLine.ForceRender()\r\n at Microsoft.PowerShell.PSConsoleReadLine.Render()\r\n at Microsoft.PowerShell.PSConsoleReadLine.Insert(String s)\r\n at Microsoft.PowerShell.PSConsoleReadLine.ReadLine(Runspace runspace, EngineIntrinsics engineIntrinsics, CancellationToken cancellationToken, Nullable`1 lastRunStatus)\r\n at Microsoft.PowerShell.PSConsoleReadLine.ReadLine(Runspace runspace, EngineIntrinsics engineIntrinsics, Nullable`1 lastRunStatus)\r\n at CallSite.Target(Closure , CallSite , Type , Object , Object , Object )\r\n Source : System.Management.Automation\r\n HResult : -2146233087\r\n StackTrace :\r\n at System.Management.Automation.ExceptionHandlingOps.ConvertToMethodInvocationException(Exception exception, Type typeToThrow, String methodName, Int32 numArgs, MemberInfo memberInfo)\r\n at CallSite.Target(Closure , CallSite , Type , Object , Object , Object )\r\n at System.Dynamic.UpdateDelegates.UpdateAndExecute4[T0,T1,T2,T3,TRet](CallSite site, T0 arg0, T1 arg1, T2 arg2, T3 arg3)\r\n at System.Management.Automation.Interpreter.DynamicInstruction`5.Run(InterpretedFrame frame)\r\n at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)\r\nCategoryInfo : NotSpecified: (:) [], MethodInvocationException\r\nFullyQualifiedErrorId : ParseException\r\nInvocationInfo :\r\n ScriptLineNumber : 7\r\n OffsetInLine : 5\r\n HistoryId : -1\r\n ScriptName : C:\\Users\\Martin\\Documents\\PowerShell\\Modules\\PSReadLine\\2.2.0\\PSReadLine.psm1\r\n Line : [Microsoft.PowerShell.PSConsoleReadLine]::ReadLine($host.Runspace, $ExecutionContext, $lastRunStatus)\r\n\r\n PositionMessage : At C:\\Users\\Martin\\Documents\\PowerShell\\Modules\\PSReadLine\\2.2.0\\PSReadLine.psm1:7 char:5\r\n + [Microsoft.PowerShell.PSConsoleReadLine]::ReadLine($host.Runspace …\r\n + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\n PSScriptRoot : C:\\Users\\Martin\\Documents\\PowerShell\\Modules\\PSReadLine\\2.2.0\r\n PSCommandPath : C:\\Users\\Martin\\Documents\\PowerShell\\Modules\\PSReadLine\\2.2.0\\PSReadLine.psm1\r\n CommandOrigin : Internal\r\nScriptStackTrace : at PSConsoleHostReadLine, C:\\Users\\Martin\\Documents\\PowerShell\\Modules\\PSReadLine\\2.2.0\\PSReadLine.psm1: line 7\n```\n\n\n### Environment data\n\n```powershell\nPS C:\\Users\\Martin> $PSVersionTable\r\n\r\nName Value\r\n---- -----\r\nPSVersion 7.2.0-preview.10\r\nPSEdition Core\r\nGitCommitId 7.2.0-preview.10\r\nOS Microsoft Windows 10.0.19044\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/MartinGC94","@type":"Person","name":"MartinGC94"},"datePublished":"2021-12-28T00:57:48Z","url":"https://github.com/PowerShell/PowerShell/issues/16676"}
| 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:79a6a67e-bdde-1225-872f-2ea115d8a019 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E8AE:3CC7E8:A0310:D8C14:6AFD8BC2 |
| html-safe-nonce | 7f7fd605c0b8e94d94f9010ca57ee576f79d563ec1bdd4773f093a023e6e4201 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFOEFFOjNDQzdFODpBMDMxMDpEOEMxNDo2QUZEOEJDMiIsInZpc2l0b3JfaWQiOiI0OTQ5ODE0NjYzOTY5MjA3NzAiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | f34d6a8a92983f601400384d36bf44ee043c16a0ef5fac018a4a5292f749560c |
| hovercard-subject-tag | issue:1089542620 |
| 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/16676/issue_layout |
| twitter:image | https://opengraph.githubassets.com/8dada36b67ca7d051007af49d7d0060e6e699dac8b9a1febfe7e3458454c67c0/PowerShell/PowerShell/issues/16676 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/8dada36b67ca7d051007af49d7d0060e6e699dac8b9a1febfe7e3458454c67c0/PowerShell/PowerShell/issues/16676 |
| 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 | MartinGC94 |
| hostname | github.com |
| expected-hostname | github.com |
| None | bc86424ef34a73b386237872800e922d149d65ba907f63d6f150a2dcb8433bea |
| 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 | 927a6c5ab1c32b38830f1b9d3050c0b9e9aa92e1 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width