Skip to content

Commit

Permalink
Document DisposeAsync intent.
Browse files Browse the repository at this point in the history
  • Loading branch information
rokonec committed Jun 6, 2024
1 parent 0d72795 commit babfa61
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/libraries/Common/tests/System/Net/RemoteExecutorExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,17 @@ namespace Microsoft.DotNet.RemoteExecutor;

internal static class RemoteExecutorExtensions
{
/// <summary>
/// Dispose the RemoteInvokeHandle synchronously can take considerable time, and cause other unrelated tests to fail on timeout
/// because of depletion of xUnit synchronization context threads.
/// Running dispose in a separate task on the thread pool can help alleviate this issue.
/// </summary>
/// <example>
/// Executes the ServerCode in separate process and awaits its completion in a separate task outside of current synchronization context.
/// <code>
/// await RemoteExecutor.Invoke(ServerCode).DisposeAsync();
/// </code>
/// </example>
public static async ValueTask DisposeAsync(this RemoteInvokeHandle handle)
{
await Task.Run(handle.Dispose);
Expand Down

0 comments on commit babfa61

Please sign in to comment.