Skip to content

PowerShell crashes when importing CompletionPredictor from another module with certain names #30

Description

@conioh

Prerequisites

  • Write a descriptive title.
  • Make sure you are able to repro it on the latest version
  • Search the existing issues.

Steps to reproduce

  1. Clone the repo https://github.com/conioh/CompletionPredictorBug to D:\
  2. Launch C:\Windows\System32\conhost.exe C:\Windows\System32\cmd.exe /k "C:\Program Files\PowerShell\7\pwsh.exe" -NoProfile
  3. Run the following command in the new PowerShell instance: Import-Module -Name "D:\CompletionPredictorBug\CompletionPredictorBug\Buggity_bug.psd1"

Expected behavior

PowerShell 7.3.4PS C:\Windows\System32> Get-ModuleModuleType Version PreRelease Name ExportedCommands---------- ------- ---------- ---- ----------------Script 2.2.6 PSReadLine {Get-PSReadLineKeyHandler, Get-PSReadLineOption, …PS C:\Windows\System32> Import-Module -Name "D:\CompletionPredictorBug\CompletionPredictorBug\CompletionPredictorBug.psd1"PS C:\Windows\System32> Get-ModuleModuleType Version PreRelease Name ExportedCommands---------- ------- ---------- ---- ----------------Manifest 0.1.1 CompletionPredictorScript 0.1.0 CompletionPredictorBugScript 2.2.6 PSReadLine {Get-PSReadLineKeyHandler, Get-PSReadLineOption, …PS C:\Windows\System32>

Actual behavior

at System.Management.Automation.PowerShell+Worker.CreateRunspaceIfNeededAndDoWork(System.Management.Automation.Runspaces.Runspace, Boolean) at System.Management.Automation.PowerShell.CoreInvokeHelper[[System.__Canon, System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.__Canon, System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.Management.Automation.PSDataCollection`1<System.__Canon>, System.Management.Automation.PSDataCollection`1<System.__Canon>, System.Management.Automation.PSInvocationSettings) at System.Management.Automation.PowerShell.CoreInvoke[[System.__Canon, System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.__Canon, System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.Management.Automation.PSDataCollection`1<System.__Canon>, System.Management.Automation.PSDataCollection`1<System.__Canon>, System.Management.Automation.PSInvocationSettings) at System.Management.Automation.PowerShell.Invoke(System.Collections.IEnumerable, System.Management.Automation.PSInvocationSettings) at Microsoft.PowerShell.Predictor.PowerShellExtensions.InvokeAndCleanup(System.Management.Automation.PowerShell) at Microsoft.PowerShell.Predictor.CompletionPredictor.SyncModules(System.Management.Automation.PowerShell) at Microsoft.PowerShell.Predictor.CompletionPredictor.SyncRunspaceState(System.Object, System.Management.Automation.Runspaces.RunspaceAvailabilityEventArgs) at System.Management.Automation.Runspaces.RunspaceBase.OnAvailabilityChanged(System.Management.Automation.Runspaces.RunspaceAvailabilityEventArgs) at System.Management.Automation.Runspaces.PipelineBase.RaisePipelineStateEvents() at System.Management.Automation.Runspaces.PipelineBase.Invoke(System.Collections.IEnumerable) at Microsoft.PowerShell.Executor.ExecuteCommandHelper(System.Management.Automation.Runspaces.Pipeline, System.Exception ByRef, ExecutionOptions) at Microsoft.PowerShell.ConsoleHost+InputLoop.Run(Boolean) at Microsoft.PowerShell.ConsoleHost+InputLoop.RunNewInputLoop(Microsoft.PowerShell.ConsoleHost, Boolean) at Microsoft.PowerShell.ConsoleHost.EnterNestedPrompt() at Microsoft.PowerShell.ConsoleHost.DoRunspaceLoop(System.String, Boolean, System.Collections.ObjectModel.Collection`1<System.Management.Automation.Runspaces.CommandParameter>, Boolean, System.String, System.String) at Microsoft.PowerShell.ConsoleHost.Run(Microsoft.PowerShell.CommandLineParameterParser, Boolean) at Microsoft.PowerShell.ConsoleHost.Start(System.String, System.String, Boolean) at Microsoft.PowerShell.UnmanagedPSEntry.Start(System.String[], Int32) at Microsoft.PowerShell.ManagedPSEntry.Main(System.String[])

Error details

No response

Environment data

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

Version

0.1.1

Visuals

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions