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
8 changes: 7 additions & 1 deletion src/Opc.Ua.Core/Stack/Tcp/UaSCBinaryClientChannel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,13 @@ public async ValueTask<IServiceResponse> SendRequestAsync(
{
OperationCompleted(operation);
}
if (operation.MessageBody is not IServiceResponse response)
IEncodeable? body = operation.MessageBody;

// the operation is often promoted while it waits (a Publish waits for the
// publishing interval); a dead old operation that still referenced the
// response would keep it alive through every collection until a full one.
operation.MessageBody = null;
if (body is not IServiceResponse response)
{
throw ServiceResultException.Create(
StatusCodes.BadUnknownResponse,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,17 @@ public interface I{{Tokens.ServiceSet}}ClientMethods{{Tokens.BaseInterfaces}}
/// <summary>
/// Invokes the {{Tokens.Name}} service.
/// </summary>
/// <remarks>
/// The state machine is pooled, so the returned task must be awaited once,
/// like any value task. A completed call keeps no reference to its response:
/// a call that waited long enough to be promoted (a Publish waits for the
/// publishing interval) would otherwise keep every later response alive
/// until the next full collection.
/// </remarks>
#if NET6_0_OR_GREATER
[global::System.Runtime.CompilerServices.AsyncMethodBuilder(
typeof(global::System.Runtime.CompilerServices.PoolingAsyncValueTaskMethodBuilder<>))]
#endif
{{Tokens.ClientMethodAsync}}
{
{{Tokens.Name}}Request request = new {{Tokens.Name}}Request();
Expand Down
Loading