Client channel: pool the state machine of SendRequestAsync

Every request allocated the async state machine box of
UaSCUaBinaryClientChannel.SendRequestAsync (~170 B). On .NET 6 and later
it uses PoolingAsyncValueTaskMethodBuilder, like the transport's send and
receive; the callers await the returned task once.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Roman Ettlinger
2026-10-19 15:12:16 +02:00
co-authored by Claude Opus 5.5
parent 4528d04676
commit 41859b64a3
@@ -358,6 +358,14 @@ namespace Opc.Ua.Bindings
/// <exception cref="ArgumentNullException"><paramref name="request"/> is <c>null</c>.</exception>
/// <exception cref="ArgumentException"></exception>
/// <exception cref="ServiceResultException"></exception>
/// <remarks>
/// The state machine of a request is pooled, so the returned task must be awaited
/// once, like any value task.
/// </remarks>
#if NET6_0_OR_GREATER
[System.Runtime.CompilerServices.AsyncMethodBuilder(
typeof(System.Runtime.CompilerServices.PoolingAsyncValueTaskMethodBuilder<>))]
#endif
public async ValueTask<IServiceResponse> SendRequestAsync(
IServiceRequest request,
int timeout,