Provides means to cleanup after the call.
If the call has already finished normally (request stream has been completed and call result has been received), doesn't do anything.
Otherwise, requests cancellation of the call which should terminate all pending async operations associated with the call.
As a result, all resources being used by the call should be released eventually.
Remarks
Normally, there is no need for you to dispose the call unless you want to utilize the
"Cancel" semantics of invokingDispose.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-04 UTC."],[[["\u003cp\u003e\u003ccode\u003eAsyncUnaryCall<TResponse>\u003c/code\u003e is a sealed class in the \u003ccode\u003eGrpc.Core\u003c/code\u003e namespace that serves as the return type for a single request-single response call within the gRPC framework.\u003c/p\u003e\n"],["\u003cp\u003eIt inherits from \u003ccode\u003eobject\u003c/code\u003e and implements \u003ccode\u003eIDisposable\u003c/code\u003e, providing methods for managing the lifecycle and resources of an asynchronous call, including cancellation.\u003c/p\u003e\n"],["\u003cp\u003eThe class provides properties \u003ccode\u003eResponseAsync\u003c/code\u003e and \u003ccode\u003eResponseHeadersAsync\u003c/code\u003e for asynchronous access to the call result and response headers, respectively.\u003c/p\u003e\n"],["\u003cp\u003eIt includes methods like \u003ccode\u003eGetStatus()\u003c/code\u003e and \u003ccode\u003eGetTrailers()\u003c/code\u003e to retrieve the call's status and trailing metadata after the call has completed, and \u003ccode\u003eDispose()\u003c/code\u003e for call cleanup.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eAsyncUnaryCall\u003c/code\u003e class has two constructors, both allowing for the asynchronous response and headers, as well as delegates for status, trailers, and dispose actions to be defined.\u003c/p\u003e\n"]]],[],null,["# Class AsyncUnaryCall<TResponse> (2.66.0)\n\nVersion latestkeyboard_arrow_down\n\n- [2.66.0 (latest)](/dotnet/docs/reference/Grpc.Core/latest/Grpc.Core.AsyncUnaryCall-1)\n- [2.63.0](/dotnet/docs/reference/Grpc.Core/2.63.0/Grpc.Core.AsyncUnaryCall-1)\n- [2.48.0](/dotnet/docs/reference/Grpc.Core/2.48.0/Grpc.Core.AsyncUnaryCall-1) \n\n public sealed class AsyncUnaryCall\u003cTResponse\u003e : IDisposable\n\nReturn type for single request - single response call. \n\nInheritance\n-----------\n\n[object](https://learn.microsoft.com/dotnet/api/system.object) \\\u003e AsyncUnaryCall\\\u003cTResponse\\\u003e \n\nImplements\n----------\n\n[IDisposable](https://learn.microsoft.com/dotnet/api/system.idisposable) \n\nInherited Members\n-----------------\n\n[object.Equals(object)](https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object)) \n[object.Equals(object, object)](https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object-system-object)) \n[object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode) \n[object.GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype) \n[object.ReferenceEquals(object, object)](https://learn.microsoft.com/dotnet/api/system.object.referenceequals) \n[object.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring)\n\nNamespace\n---------\n\n[Grpc.Core](/dotnet/docs/reference/Grpc.Core/latest/Grpc.Core)\n\nAssembly\n--------\n\nGrpc.Core.Api.dll\n\nConstructors\n------------\n\n### AsyncUnaryCall(Task\\\u003cTResponse\\\u003e, Func\\\u003cobject, Task\\\u003cMetadata\\\u003e\\\u003e, Func\\\u003cobject, Status\\\u003e, Func\\\u003cobject, Metadata\\\u003e, Action\\\u003cobject\\\u003e, object)\n\n public AsyncUnaryCall(Task\u003cTResponse\u003e responseAsync, Func\u003cobject, Task\u003cMetadata\u003e\u003e responseHeadersAsync, Func\u003cobject, Status\u003e getStatusFunc, Func\u003cobject, Metadata\u003e getTrailersFunc, Action\u003cobject\u003e disposeAction, object state)\n\nCreates a new AsyncUnaryCall object with the specified properties.\n\n### AsyncUnaryCall(Task\\\u003cTResponse\\\u003e, Task\\\u003cMetadata\\\u003e, Func\\\u003cStatus\\\u003e, Func\\\u003cMetadata\\\u003e, Action)\n\n public AsyncUnaryCall(Task\u003cTResponse\u003e responseAsync, Task\u003cMetadata\u003e responseHeadersAsync, Func\u003cStatus\u003e getStatusFunc, Func\u003cMetadata\u003e getTrailersFunc, Action disposeAction)\n\nCreates a new AsyncUnaryCall object with the specified properties.\n\nProperties\n----------\n\n### ResponseAsync\n\n public Task\u003cTResponse\u003e ResponseAsync { get; }\n\nAsynchronous call result.\n\n### ResponseHeadersAsync\n\n public Task\u003cMetadata\u003e ResponseHeadersAsync { get; }\n\nAsynchronous access to response headers.\n\nMethods\n-------\n\n### ConfigureAwait(bool)\n\n public ConfiguredTaskAwaitable\u003cTResponse\u003e ConfigureAwait(bool continueOnCapturedContext)\n\nConfigures an awaiter used to await this [AsyncUnaryCall\\\u003cTResponse\\\u003e](/dotnet/docs/reference/Grpc.Core/latest/Grpc.Core.AsyncUnaryCall-1).\n\n### Dispose()\n\n public void Dispose()\n\nProvides means to cleanup after the call.\nIf the call has already finished normally (request stream has been completed and call result has been received), doesn't do anything.\nOtherwise, requests cancellation of the call which should terminate all pending async operations associated with the call.\nAs a result, all resources being used by the call should be released eventually.\n**Remarks** \nNormally, there is no need for you to dispose the call unless you want to utilize the\n\"Cancel\" semantics of invoking `Dispose`.\n\n### GetAwaiter()\n\n public TaskAwaiter\u003cTResponse\u003e GetAwaiter()\n\nGets an awaiter used to await this [AsyncUnaryCall\\\u003cTResponse\\\u003e](/dotnet/docs/reference/Grpc.Core/latest/Grpc.Core.AsyncUnaryCall-1).\n\n**Remarks** \nThis method is intended for compiler use rather than use directly in code.\n\n### GetStatus()\n\n public Status GetStatus()\n\nGets the call status if the call has already finished.\nThrows InvalidOperationException otherwise.\n\n### GetTrailers()\n\n public Metadata GetTrailers()\n\nGets the call trailing metadata if the call has already finished.\nThrows InvalidOperationException otherwise."]]