@@ -2915,6 +2915,9 @@ public IAsyncResult BeginInvoke<T>(PSDataCollection<T> input)
2915
2915
/// </param>
2916
2916
/// <param name="callback">
2917
2917
/// An AsyncCallback to call once the BeginInvoke completes.
2918
+ /// Note: when using this API in script, don't pass in a delegate that is cast from a script block.
2919
+ /// The callback could be invoked from a thread without a default Runspace and a delegate cast from
2920
+ /// a script block would fail in that case.
2918
2921
/// </param>
2919
2922
/// <param name="state">
2920
2923
/// A user supplied state to call the <paramref name="callback"/>
@@ -3036,6 +3039,9 @@ public IAsyncResult BeginInvoke<TInput, TOutput>(PSDataCollection<TInput> input,
3036
3039
/// </param>
3037
3040
/// <param name="callback">
3038
3041
/// An AsyncCallback to call once the BeginInvoke completes.
3042
+ /// Note: when using this API in script, don't pass in a delegate that is cast from a script block.
3043
+ /// The callback could be invoked from a thread without a default Runspace and a delegate cast from
3044
+ /// a script block would fail in that case.
3039
3045
/// </param>
3040
3046
/// <param name="state">
3041
3047
/// A user supplied state to call the <paramref name="callback"/>
@@ -3158,6 +3164,9 @@ public Task<PSDataCollection<PSObject>> InvokeAsync<T>(PSDataCollection<T> input
3158
3164
/// </param>
3159
3165
/// <param name="callback">
3160
3166
/// An AsyncCallback to call once the command is invoked.
3167
+ /// Note: when using this API in script, don't pass in a delegate that is cast from a script block.
3168
+ /// The callback could be invoked from a thread without a default Runspace and a delegate cast from
3169
+ /// a script block would fail in that case.
3161
3170
/// </param>
3162
3171
/// <param name="state">
3163
3172
/// A user supplied state to call the <paramref name="callback"/>
@@ -3264,6 +3273,9 @@ public Task<PSDataCollection<PSObject>> InvokeAsync<TInput, TOutput>(PSDataColle
3264
3273
/// </param>
3265
3274
/// <param name="callback">
3266
3275
/// An AsyncCallback to call once the command is invoked.
3276
+ /// Note: when using this API in script, don't pass in a delegate that is cast from a script block.
3277
+ /// The callback could be invoked from a thread without a default Runspace and a delegate cast from
3278
+ /// a script block would fail in that case.
3267
3279
/// </param>
3268
3280
/// <param name="state">
3269
3281
/// A user supplied state to call the <paramref name="callback"/>
@@ -3733,6 +3745,9 @@ public void Stop()
3733
3745
/// </summary>
3734
3746
/// <param name="callback">
3735
3747
/// A AsyncCallback to call once the BeginStop completes.
3748
+ /// Note: when using this API in script, don't pass in a delegate that is cast from a script block.
3749
+ /// The callback could be invoked from a thread without a default Runspace and a delegate cast from
3750
+ /// a script block would fail in that case.
3736
3751
/// </param>
3737
3752
/// <param name="state">
3738
3753
/// A user supplied state to call the <paramref name="callback"/>
@@ -3794,6 +3809,9 @@ public void EndStop(IAsyncResult asyncResult)
3794
3809
/// </remarks>
3795
3810
/// <param name="callback">
3796
3811
/// An AsyncCallback to call once the command is invoked.
3812
+ /// Note: when using this API in script, don't pass in a delegate that is cast from a script block.
3813
+ /// The callback could be invoked from a thread without a default Runspace and a delegate cast from
3814
+ /// a script block would fail in that case.
3797
3815
/// </param>
3798
3816
/// <param name="state">
3799
3817
/// A user supplied state to call the <paramref name="callback"/>
0 commit comments