public async Task <Response> DownloadToAsync( Stream destination, BlobRequestConditions conditions, CancellationToken cancellationToken) { // Wrap the download range calls in a Download span for distributed // tracing DiagnosticScope scope = _client.ClientConfiguration.ClientDiagnostics.CreateScope($"{nameof(BlobBaseClient)}.{nameof(BlobBaseClient.DownloadTo)}"); try { scope.Start(); // Just start downloading using an initial range. If it's a // small blob, we'll get the whole thing in one shot. If it's // a large blob, we'll get its full size in Content-Range and // can keep downloading it in segments. var initialRange = new HttpRange(0, _initialRangeSize); Task <Response <BlobDownloadStreamingResult> > initialResponseTask = _client.DownloadStreamingAsync( initialRange, conditions, rangeGetContentHash: false, cancellationToken); Response <BlobDownloadStreamingResult> initialResponse = null; try { initialResponse = await initialResponseTask.ConfigureAwait(false); } catch (RequestFailedException ex) when(ex.ErrorCode == BlobErrorCode.InvalidRange) { initialResponse = await _client.DownloadStreamingAsync( range : default,