public ValueTask ReleaseAsync(GrpcActivatorHandle <Interceptor> interceptor)
        {
            if (interceptor.Instance == null)
            {
                throw new ArgumentException("Interceptor instance is null.", nameof(interceptor));
            }

            if (interceptor.Created)
            {
                if (interceptor.Instance is IAsyncDisposable asyncDisposableInterceptor)
                {
                    return(asyncDisposableInterceptor.DisposeAsync());
                }

                if (interceptor.Instance is IDisposable disposableInterceptor)
                {
                    disposableInterceptor.Dispose();
                    return(default);
        public ValueTask ReleaseAsync(GrpcActivatorHandle <TGrpcService> service)
        {
            if (service.Instance == null)
            {
                throw new ArgumentException("Service instance is null.", nameof(service));
            }

            if (service.Created)
            {
                if (service.Instance is IAsyncDisposable asyncDisposableService)
                {
                    return(asyncDisposableService.DisposeAsync());
                }

                if (service.Instance is IDisposable disposableService)
                {
                    disposableService.Dispose();
                    return(default);