Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug(?): tab completing [ causes an error to be logged #17542

Closed
5 tasks done
insomnimus opened this issue Jun 19, 2022 · 5 comments
Closed
5 tasks done

bug(?): tab completing [ causes an error to be logged #17542

insomnimus opened this issue Jun 19, 2022 · 5 comments
Labels
Issue-Bug Issue has been identified as a bug in the product Resolution-No Activity Issue has had no activity for 6 months or more WG-Interactive-IntelliSense tab completion

Comments

@insomnimus
Copy link

insomnimus commented Jun 19, 2022

Prerequisites

Steps to reproduce

Given the full and only command line:

[

Pressing tab at the end of the buffer (right after the bracket) causes an error to be logged to $Error.

Expected behavior

No error to be logged to `$Error`, even if no completion is produced.

Actual behavior

An error is logged to `$Error` right after pressing tab.

Error details

Type           : System.Management.Automation.CmdletInvocationException
ErrorRecord    : 
    Exception             : 
        Type        : System.Management.Automation.WildcardPatternException
        ErrorRecord : 
            Exception             : 
                Type    : System.Management.Automation.ParentContainsErrorRecordException
                Message : The specified wildcard character pattern is not valid: \[*
                HResult : -2146233087
            CategoryInfo          : NotSpecified: (:) [], ParentContainsErrorRecordException
            FullyQualifiedErrorId : RuntimeException
        TargetSite  : 
            Name          : Parse
            DeclaringType : System.Management.Automation.WildcardPatternParser, System.Management.Automation, Version=7.2.4.500, Culture=neutral, PublicKeyToken=31bf3856ad364e35
            MemberType    : Method
            Module        : System.Management.Automation.dll
        Message     : The specified wildcard character pattern is not valid: \[*
        Source      : System.Management.Automation
        HResult     : -2146233087
        StackTrace  : 
   at System.Management.Automation.WildcardPatternParser.Parse(WildcardPattern pattern, WildcardPatternParser parser)
   at System.Management.Automation.WildcardPatternMatcher.MyWildcardPatternParser.Parse(WildcardPattern pattern, CharacterNormalizer characterNormalizer)
   at System.Management.Automation.WildcardPatternMatcher..ctor(WildcardPattern wildcardPattern)
   at System.Management.Automation.WildcardPattern.Init()
   at System.Management.Automation.LocationGlobber.IsChildNameAMatch(PSObject childObject, WildcardPattern stringMatcher, Collection`1 includeMatcher, Collection`1 excludeMatcher, String& childName)
   at System.Management.Automation.LocationGlobber.GenerateNewPSPathsWithGlobLeaf(List`1 currentDirs, PSDriveInfo drive, String leafElement, Boolean isLastLeaf, ContainerCmdletProvider provider, CmdletProviderContext context)
   at System.Management.Automation.LocationGlobber.ExpandMshGlobPath(String path, Boolean allowNonexistingPaths, PSDriveInfo drive, ContainerCmdletProvider provider, CmdletProviderContext context)
   at System.Management.Automation.LocationGlobber.ResolveDriveQualifiedPath(String path, CmdletProviderContext context, Boolean allowNonexistingPaths, CmdletProvider& providerInstance)
   at System.Management.Automation.LocationGlobber.GetGlobbedMonadPathsFromMonadPath(String path, Boolean allowNonexistingPaths, CmdletProviderContext context, CmdletProvider& providerInstance)
   at System.Management.Automation.PathIntrinsics.GetResolvedPSPathFromPSPath(String path, CmdletProviderContext context)
   at Microsoft.PowerShell.Commands.ResolvePathCommand.ProcessRecord()
   at System.Management.Automation.Cmdlet.DoProcessRecord()
   at System.Management.Automation.CommandProcessor.ProcessRecord()
    CategoryInfo          : NotSpecified: (:) [Resolve-Path], WildcardPatternException
    FullyQualifiedErrorId : RuntimeException,Microsoft.PowerShell.Commands.ResolvePathCommand
    InvocationInfo        : 
        MyCommand       : Resolve-Path
        HistoryId       : 2
        InvocationName  : Microsoft.PowerShell.Management\Resolve-Path
        CommandOrigin   : Internal
    ScriptStackTrace      : at <ScriptBlock><End>, <No file>: line 38
    PipelineIterationInfo : 



TargetSite     : 
    Name          : Invoke
    DeclaringType : System.Management.Automation.Runspaces.PipelineBase, System.Management.Automation, Version=7.2.4.500, Culture=neutral, PublicKeyToken=31bf3856ad364e35
    MemberType    : Method
    Module        : System.Management.Automation.dll
Message        : The specified wildcard character pattern is not valid: \[*
InnerException : 
    Type        : System.Management.Automation.WildcardPatternException
    ErrorRecord : 
        Exception             : 
            Type    : System.Management.Automation.ParentContainsErrorRecordException
            Message : The specified wildcard character pattern is not valid: \[*
            HResult : -2146233087
        CategoryInfo          : NotSpecified: (:) [], ParentContainsErrorRecordException
        FullyQualifiedErrorId : RuntimeException
    TargetSite  : 
        Name          : Parse
        DeclaringType : System.Management.Automation.WildcardPatternParser, System.Management.Automation, Version=7.2.4.500, Culture=neutral, PublicKeyToken=31bf3856ad364e35
        MemberType    : Method
        Module        : System.Management.Automation.dll
    Message     : The specified wildcard character pattern is not valid: \[*
    Source      : System.Management.Automation
    HResult     : -2146233087
    StackTrace  : 
   at System.Management.Automation.WildcardPatternParser.Parse(WildcardPattern pattern, WildcardPatternParser parser)
   at System.Management.Automation.WildcardPatternMatcher.MyWildcardPatternParser.Parse(WildcardPattern pattern, CharacterNormalizer characterNormalizer)
   at System.Management.Automation.WildcardPatternMatcher..ctor(WildcardPattern wildcardPattern)
   at System.Management.Automation.WildcardPattern.Init()
   at System.Management.Automation.LocationGlobber.IsChildNameAMatch(PSObject childObject, WildcardPattern stringMatcher, Collection`1 includeMatcher, Collection`1 excludeMatcher, String& childName)
   at System.Management.Automation.LocationGlobber.GenerateNewPSPathsWithGlobLeaf(List`1 currentDirs, PSDriveInfo drive, String leafElement, Boolean isLastLeaf, ContainerCmdletProvider provider, CmdletProviderContext context)
   at System.Management.Automation.LocationGlobber.ExpandMshGlobPath(String path, Boolean allowNonexistingPaths, PSDriveInfo drive, ContainerCmdletProvider provider, CmdletProviderContext context)
   at System.Management.Automation.LocationGlobber.ResolveDriveQualifiedPath(String path, CmdletProviderContext context, Boolean allowNonexistingPaths, CmdletProvider& providerInstance)
   at System.Management.Automation.LocationGlobber.GetGlobbedMonadPathsFromMonadPath(String path, Boolean allowNonexistingPaths, CmdletProviderContext context, CmdletProvider& providerInstance)
   at System.Management.Automation.PathIntrinsics.GetResolvedPSPathFromPSPath(String path, CmdletProviderContext context)
   at Microsoft.PowerShell.Commands.ResolvePathCommand.ProcessRecord()
   at System.Management.Automation.Cmdlet.DoProcessRecord()
   at System.Management.Automation.CommandProcessor.ProcessRecord()
Source         : System.Management.Automation
HResult        : -2146233087
StackTrace     : 
   at System.Management.Automation.Runspaces.PipelineBase.Invoke(IEnumerable input)
   at System.Management.Automation.PowerShell.Worker.ConstructPipelineAndDoWork(Runspace rs, Boolean performSyncInvoke)
   at System.Management.Automation.PowerShell.CoreInvokeHelper[TInput,TOutput](PSDataCollection`1 input, PSDataCollection`1 output, PSInvocationSettings settings)
   at System.Management.Automation.PowerShell.CoreInvoke[TInput,TOutput](PSDataCollection`1 input, PSDataCollection`1 output, PSInvocationSettings settings)
   at System.Management.Automation.PowerShell.CoreInvoke[TOutput](IEnumerable input, PSDataCollection`1 output, PSInvocationSettings settings)
   at System.Management.Automation.PowerShell.Invoke(IEnumerable input, PSInvocationSettings settings)
   at System.Management.Automation.PowerShellExecutionHelper.ExecuteCurrentPowerShell(Exception& exceptionThrown, IEnumerable input)


### Environment data

```powershell
Name                           Value
----                           -----
PSVersion                      7.2.4
PSEdition                      Core
GitCommitId                    7.2.4
OS                             Microsoft Windows 10.0.19044
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0


### Visuals

_No response_
@insomnimus insomnimus added the Needs-Triage The issue is new and needs to be triaged by a work group. label Jun 19, 2022
@iSazonov iSazonov added the WG-Interactive-IntelliSense tab completion label Jun 20, 2022
@iSazonov iSazonov added the Waiting on Author The PR was reviewed and requires changes or comments from the author before being accept label Jul 25, 2023
@theJasonHelmick
Copy link
Collaborator

@insomnimus - Thank you for reporting this issue. The Working Group has been able to reproduce this issue. We will look into this bug.

@theJasonHelmick theJasonHelmick added Issue-Bug Issue has been identified as a bug in the product and removed Waiting on Author The PR was reviewed and requires changes or comments from the author before being accept Needs-Triage The issue is new and needs to be triaged by a work group. labels Jul 26, 2023
@kilasuit
Copy link
Collaborator

I could reproduce this in the latest LTS (7.2.13) & Stable (7.3.6) and these returned the same error as provided by the user. Attempts in v7.4.0-preview4 and the latest daily, as @sdwheeler mentioned for me did not return this error so I think that this was recently fixed and therefore needs to be looked into which PR fixed this & whether this can be backported at all to both LTS and Stable versions.

I also then started another instance of each with pwsh -noprofile -noninteractive in the above to rule out it just being within PSReadline & got the same error in LTS & Stable and no error in either 7.4.0-preview4 or the latest daily.

All tested on Microsoft Windows 10.0.25905

@MartinGC94
Copy link
Contributor

@kilasuit It was probably fixed by this PR: #19489 which was pretty much a complete rewrite of the file completion logic. Backporting a huge change like that to LTS seems unrealistic, even if it is a very nice change (I would love if all my changes got backported to 5.1 as well 😁)

@kilasuit
Copy link
Collaborator

Seeing as 7.4 will be the next LTS - I don't think it's too unrealistic to say that if that was the fix @MartinGC94 that it's not planned for backporting - however that's up to the team to decide.

@microsoft-github-policy-service microsoft-github-policy-service bot added the Resolution-No Activity Issue has had no activity for 6 months or more label Jan 26, 2024
Copy link
Contributor

This issue has not had any activity in 6 months, if there is no further activity in 7 days, the issue will be closed automatically.

Activity in this case refers only to comments on the issue. If the issue is closed and you are the author, you can re-open the issue using the button below. Please add more information to be considered during retriage. If you are not the author but the issue is impacting you after it has been closed, please submit a new issue with updated details and a link to this issue and the original.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue-Bug Issue has been identified as a bug in the product Resolution-No Activity Issue has had no activity for 6 months or more WG-Interactive-IntelliSense tab completion
Projects
None yet
Development

No branches or pull requests

5 participants