8000 Fixing test run crash by not passing script block to the callback by daxian-dbw · Pull Request #9298 · PowerShell/PowerShell · GitHub
[go: up one dir, main page]

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2915,6 +2915,9 @@ public IAsyncResult BeginInvoke<T>(PSDataCollection<T> input)
/// </param>
/// <param name="callback">
/// An AsyncCallback to call once the BeginInvoke completes.
/// Note: when using this API in script, don't pass in a delegate that is cast from a script block.
/// The callback could be invoked from a thread without a default Runspace and a delegate cast from
/// a script block would fail in that case.
/// </param>
/// <param name="state">
/// A user supplied state to call the <paramref name="callback"/>
Expand Down Expand Up @@ -3036,6 +3039,9 @@ public IAsyncResult BeginInvoke<TInput, TOutput>(PSDataCollection<TInput> input,
/// </param>
/// <param name="callback">
/// An AsyncCallback to call once the BeginInvoke completes.
/// Note: when using this API in script, don't pass in a delegate that is cast from a script block.
/// The callback could be invoked from a thread without a default Runspace and a delegate cast from
/// a script block would fail in that case.
/// </param>
/// <param name="state">
/// A user supplied state to call the <paramref name="callback"/>
Expand Down Expand Up @@ -3158,6 +3164,9 @@ public Task<PSDataCollection<PSObject>> InvokeAsync<T>(PSDataCollection<T> input
/// </param>
/// <param name="callback">
/// An AsyncCallback to call once the command is invoked.
/// Note: when using this API in script, don't pass in a delegate that is cast from a script block.
/// The callback could be invoked from a thread without a default Runspace and a delegate cast from
/// a script block would fail in that case.
/// </param>
/// <param name="state">
/// A user supplied state to call the <paramref name="callback"/>
Expand Down Expand Up @@ -3264,6 +3273,9 @@ public Task<PSDataCollection<PSObject>> InvokeAsync<TInput, TOutput>(PSDataColle
/// </param>
/// <param name="callback">
/// An AsyncCallback to call once the command is invoked.
/// Note: when using this API in script, don't pass in a delegate that is cast from a script block.
/// The callback could be invoked from a thread without a default Runspace and a delegate cast from
/// a script block would fail in that case.
/// </param>
/// <param name="state">
/// A user supplied state to call the <paramref name="callback"/>
Expand Down Expand Up @@ -3733,6 +3745,9 @@ public void Stop()
/// </summary>
/// <param name="callback">
/// A AsyncCallback to call once the BeginStop completes.
/// Note: when using this API in script, don't pass in a delegate that is cast from a script block.
/// The callback could be invoked from a thread without a default Runspace and a delegate cast from
/// a script block would fail in that case.
/// </param>
/// <param name="state">
/// A user supplied state to call the <paramref name="callback"/>
Expand Down Expand Up @@ -3794,6 +3809,9 @@ public void EndStop(IAsyncResult asyncResult)
/// </remarks>
/// <param name="callback">
/// An AsyncCallback to call once the command is invoked.
/// Note: when using this API in script, don't pass in a delegate that is cast from a script block.
/// The callback could be invoked from a thread without a default Runspace and a delegate cast from
/// a script block would fail in that case.
/// </param>
/// <param name="state">
/// A user supplied state to call the <paramref name="callback"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ try {
try {
$ir = $ps.AddScript("Start-Sleep -Seconds 60").InvokeAsync()
Wait-UntilTrue { $ps.InvocationStateInfo.State -eq [System.Management.Automation.PSInvocationState]::Running }
$sr = $ps.StopAsync({}, $null)
$sr = $ps.StopAsync($null, $null)
[System.Threading.Tasks.Task]::WaitAll(@($sr))
$sr.IsCompletedSuccessfully | Should -Be $true
$ir.IsFaulted | Should -Be $true
Expand Down
0