PowerShell / PowerShell/PowerShellEditorServices

$psEditor does not handle 32/64 bit file redirection

Ouverte
#253 1 commentaire 0 réactions 0 personnes assignées Voir sur GitHub

Personne n'a encore pris cette issue.

Area-Extension Terminal Issue-Bug
Langage dominant
C#
Étoiles
767
Forks
266
Merge moyen
3 j 16 h
PR mergées (30 j)
1

Description

PSES is properly running in a 64bit context, but when it passes a path to be opened in VSCode it is being redirected to the 32bit path.

Example:

Register-EditorCommand `
    -Name 'PowerShellEditorServices.OpenAllUserEditorProfile' `
    -DisplayName 'Open All User Editor Profile' `
    -SuppressOutput `
    -ScriptBlock {
        param([Microsoft.PowerShell.EditorServices.Extensions.EditorContext]$context)

        $ProfilePath = Join-Path -Path $PShome -ChildPath 'Microsoft.VSCode_profile.ps1'
        If (!(Test-Path -Path $ProfilePath)) { New-Item -Path $ProfilePath -ItemType File }

        $psEditor.Workspace.OpenFile($ProfilePath)
    }

The Editor Command properly creates

"C:\Windows\System32\WindowsPowerShell\v1.0\Microsoft.VSCode_profile.ps1"

Then when the same path is passed to $psEditor.Workspace.OpenFile and it is passing it to VSCode to open, Code is not handling the 32/64 redirect. This has terrible consequences for the user.

Code the attempts to open the following path:

"C:\Windows\sysWOW64\WindowsPowerShell\v1.0\Microsoft.VSCode_profile.ps1"

The command silently fails because the item does not exist.

As a temporary workaround you could pass $psEditor this path and it will work:

"C:\Windows\sysnative\WindowsPowerShell\v1.0\Microsoft.PowerShell_profile.ps1"

This is not really a good solution and really should be addressed by VSCode. If they never plan on making a 64 bit client, they need to be handling 32/64 redirect. However, since I really don't think that will happen(or if it does, its likely not anytime soon), maybe we can get PSES handling this by passing the sysnative path if PSES is running in a 64 bit context.

Guide de contribution

Ouvrir le guide de contribution

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Piste de recherche

Commencez par suivre le point d’entrée $psEditor.Workspace.OpenFile et la manière dont il transmet les chemins Windows à VSCode. Reproduisez la redirection 32/64-bit avec l’exemple de profile-path fourni, puis comparez-la avec le contournement sysnative. C’est terminé lorsqu’un chemin 64-bit valide s’ouvre sans cibler silencieusement le chemin sysWOW64 inexistant.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
csharp, powershell, vscode
Domaine
devtools, operating-systems
Type d'issue
Bug
Difficulté
4/5
Temps estimé
3-5 jours
Activité
À l'abandon
Clarté
Plutôt claire
Accessibilité débutants
38/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.