This repository is for active development of the Azure SDK for .NET. For consumers of the SDK we recommend visiting our public developer docs at https://learn.microsoft.com/dotnet/azure/ or our versioned developer docs at https://azure.github.io/azure-sdk-for-net.
MIT License
5.46k
stars
4.8k
forks
source link
[BUG] Method overload `BlobBaseClient.OpenReadAsync(bool allowBlobModifications,...)` incorrectly handles the `allowBlobModifications` flag #45516
which sets allowModifications: false flag when calling to OpenReadInternal without taking into account the value of user-provided flag allowBlobModifications in the very first method. This causes allowBlobModifications = true to be ignored.
var options = new BlobOpenReadOptions(allowModifications: true)
{
BufferSize = clientBufferSize
};
Expected behavior
The allowBlobModifications flag is used in a correct way for all overloads of OpenRead method.
Actual behavior
The allowBlobModifications is ignored for the overload mentioned above.
Reproduction Steps
var client = new BlockBlobClient(...);
client.Upload(...); // Initial content
using var stream = client.OpenRead(allowBlobModifications: true);
stream.Read(...); // OK
client.Upload(...); // Modify content
stream.Read(...); // Fails (given that data are not available in the buffer from the previous fetch)
Environment
.NET SDK:
Version: 8.0.204
Commit: c338c7548c
Workload version: 8.0.200-manifests.7d36c14f
Runtime Environment:
OS Name: Windows
OS Version: 10.0.22631
OS Platform: Windows
RID: win-x64
Base Path: C:\Program Files\dotnet\sdk\8.0.204\
.NET workloads installed:
There are no installed workloads to display.
Host:
Version: 8.0.4
Architecture: x64
Commit: 2d7eea2529
Library name and version
Azure.Storage.Blobs 12.20.0
Describe the bug
Method overload https://github.com/Azure/azure-sdk-for-net/blob/2944f6eb233d5487572bfde399d96b5fcc993944/sdk/storage/Azure.Storage.Blobs/src/BlobBaseClient.cs#L3069
is calling overload
https://github.com/Azure/azure-sdk-for-net/blob/2944f6eb233d5487572bfde399d96b5fcc993944/sdk/storage/Azure.Storage.Blobs/src/BlobBaseClient.cs#L3029
which sets
allowModifications: false
flag when calling toOpenReadInternal
without taking into account the value of user-provided flagallowBlobModifications
in the very first method. This causesallowBlobModifications = true
to be ignored.As a workaround, I was able to use the overload
https://github.com/Azure/azure-sdk-for-net/blob/2944f6eb233d5487572bfde399d96b5fcc993944/sdk/storage/Azure.Storage.Blobs/src/BlobBaseClient.cs#L2912
that acts as expected for the following options:
Expected behavior
The
allowBlobModifications
flag is used in a correct way for all overloads ofOpenRead
method.Actual behavior
The
allowBlobModifications
is ignored for the overload mentioned above.Reproduction Steps
Environment