PowerShell / PowerShell/PowerShellEditorServices
$psEditor does not handle 32/64 bit file redirection
Nessuno ha ancora preso questa issue.
- Lingua principale
- C#
- Stelle
- 767
- Fork
- 266
- Merge medio
- 3g 16h
- PR unite (30g)
- 1
Descrizione
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.
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia tracciando il punto di ingresso $psEditor.Workspace.OpenFile e il modo in cui passa i percorsi Windows a VSCode. Riproduci il reindirizzamento 32/64-bit usando l’esempio di profile-path fornito, quindi confrontalo con il workaround sysnative. Il lavoro è completato quando un percorso 64-bit valido si apre senza puntare silenziosamente al percorso sysWOW64 inesistente.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- csharp, powershell, vscode
- Ambito
- devtools, operating-systems
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 38/100