PowerShell / PowerShell/vscode-powershell
'Safe handle has been closed' when stopping debugger while in a dynamicparam section in v2.2
Aperta
@andyleejordan ci sta già lavorando.
Dal 3/2/2022.
Area-Debugging
Issue-Bug
- Lingua principale
- TypeScript
- Stelle
- 1.9k
- Fork
- 548
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
Prerequisites
- Write a descriptive title.
- Make sure you are able to repro it on the latest released version
- Search the existing issues, especially the pinned issues.
Exception report
Last 200 Keys:
<omitted irrelevant keystrokes>
f o o Spacebar - b Tab
### Exception
System.ObjectDisposedException: Safe handle has been closed
at System.Threading.WaitHandle.WaitMultiple(WaitHandle[] waitHandles, Int32 millisecondsTimeout, Boolean exitContext, Boolean WaitAll)
at System.Threading.WaitHandle.WaitAny(WaitHandle[] waitHandles, Int32 millisecondsTimeout, Boolean exitContext)
at Microsoft.PowerShell.PSConsoleReadLine.ReadKey()
at Microsoft.PowerShell.PSConsoleReadLine.InputLoop()
at Microsoft.PowerShell.PSConsoleReadLine.ReadLine(Runspace runspace, EngineIntrinsics engineIntrinsics, CancellationToken cancellationToken, Nullable`1 lastRunStatus)
Screenshot
N/A
Environment data
PS Version: 5.1.19041.1320
PS HostName: Visual Studio Code Host
PSReadLine Version: 2.2.0-beta4
PSReadLine EditMode: Windows
OS: 10.0.19041.1 (WinBuild.160101.0800)
BufferWidth: 227
BufferHeight: 28
Steps to reproduce
- Use VS Code with PowerShell Preview 2021.12.0 extension
- Create a function with dynamic parameters, e.g.:
function foo
{
[CmdletBinding()]
param ()
dynamicparam
{
$DynParams = [Management.Automation.RuntimeDefinedParameterDictionary]::new()
$DynParam = [Management.Automation.RuntimeDefinedParameter]::new(
'bar',
[string],
[Collections.ObjectModel.Collection[System.Attribute]]::new()
)
$DynParams.Add($DynParam.Name, $DynParam)
return $DynParams
}
}
- Put a breakpoint within the
dynamicparamblock and start an interactive session - Invoke the dynamic parameter with
foo -and hit <tab> - Debugger stops in the
dynamicparamblock, as expected - Stop the debugger with <Ctrl-F5>
- Integrated console returns, but shows error message
Expected behavior
No exception
Actual behavior
Error shown
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.
Valutazione
Questa issue non è ancora stata valutata.