Azure / azure-sdk-for-net

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.37k stars 4.79k forks source link

[BUG] BlobContainerClient.ExistsAsync throws exception after upgrading 12.20.0 => 12.21.0 #45113

Closed invertedtomato closed 2 months ago

invertedtomato commented 3 months ago

Library name and version

Azure.Storage.Blobs

Describe the bug

After upgrading from 12.20.0 => 12.21.0 BlobContainerClient.ExistsAsync(...) fails with the following exception:

Unhandled exception. System.AggregateException: One or more errors occurred. (Failed to compare two elements in the array.)
 ---> System.InvalidOperationException: Failed to compare two elements in the array.
 ---> System.TypeInitializationException: The type initializer for 'Azure.Storage.StorageSharedKeyPipelinePolicy' threw an exception.
 ---> System.Globalization.CultureNotFoundException: Only the invariant culture is supported in globalization-invariant mode. See https://aka.ms/GlobalizationInvariantMode for more information. (Parameter 'name')
en-US is an invalid culture identifier.
   at System.Globalization.CultureInfo..ctor(String name, Boolean useUserOverride)
   at Azure.Storage.StorageSharedKeyPipelinePolicy..cctor()
   --- End of inner exception stack trace ---
   at Azure.Storage.StorageSharedKeyPipelinePolicy.<>c.<BuildCanonicalizedHeaders>b__6_0(HttpHeader x, HttpHeader y)
   at System.Collections.Generic.ArraySortHelper`1.InsertionSort(Span`1 keys, Comparison`1 comparer)
   at System.Collections.Generic.ArraySortHelper`1.IntroSort(Span`1 keys, Int32 depthLimit, Comparison`1 comparer)
   at System.Collections.Generic.ArraySortHelper`1.IntrospectiveSort(Span`1 keys, Comparison`1 comparer)
   at System.Collections.Generic.ArraySortHelper`1.Sort(Span`1 keys, Comparison`1 comparer)
   --- End of inner exception stack trace ---
   at System.Collections.Generic.ArraySortHelper`1.Sort(Span`1 keys, Comparison`1 comparer)
   at System.Collections.Generic.List`1.Sort(Comparison`1 comparison)
   at Azure.Storage.StorageSharedKeyPipelinePolicy.BuildCanonicalizedHeaders(StringBuilder stringBuilder, HttpMessage message)
   at Azure.Storage.StorageSharedKeyPipelinePolicy.BuildStringToSign(HttpMessage message)
   at Azure.Storage.StorageSharedKeyPipelinePolicy.OnSendingRequest(HttpMessage message)
   at Azure.Core.Pipeline.HttpPipelineSynchronousPolicy.ProcessAsync(HttpMessage message, ReadOnlyMemory`1 pipeline)
   at Azure.Core.Pipeline.HttpPipelinePolicy.ProcessNextAsync(HttpMessage message, ReadOnlyMemory`1 pipeline)
   at Azure.Core.Pipeline.HttpPipelineSynchronousPolicy.InnerProcessAsync(HttpMessage message, ReadOnlyMemory`1 pipeline)
   at Azure.Core.Pipeline.RedirectPolicy.ProcessAsync(HttpMessage message, ReadOnlyMemory`1 pipeline, Boolean async)
   at Azure.Core.Pipeline.RetryPolicy.ProcessAsync(HttpMessage message, ReadOnlyMemory`1 pipeline, Boolean async)
   at Azure.Core.Pipeline.RetryPolicy.ProcessAsync(HttpMessage message, ReadOnlyMemory`1 pipeline, Boolean async)
   at Azure.Core.Pipeline.HttpPipelineSynchronousPolicy.InnerProcessAsync(HttpMessage message, ReadOnlyMemory`1 pipeline)
   at Azure.Storage.Blobs.ContainerRestClient.GetPropertiesAsync(Nullable`1 timeout, String leaseId, CancellationToken cancellationToken)
   at Azure.Storage.Blobs.BlobContainerClient.GetPropertiesInternal(BlobRequestConditions conditions, Boolean async, CancellationToken cancellationToken)
   at Azure.Storage.Blobs.BlobContainerClient.ExistsInternal(Boolean async, CancellationToken cancellationToken)
   at Azure.Storage.Blobs.BlobContainerClient.ExistsAsync(CancellationToken cancellationToken)
   at <my code>

I'm running my production environment using an invariant culture.

Expected behavior

BlobContainerClient.ExistsAsync(...) to return if the container exists

Actual behavior

An exception is thrown.

Reproduction Steps

Call BlobContainerClient.ExistsAsync(...) after building code using:

dotnet publish vehicle-listing/vehicle-listing.application/vehicle-listing.application.csproj \
        --configuration Release \
        --output /app \
        --self-contained false \
        /p:UseAppHost=false \
        --nologo

And running in a mcr.microsoft.com/dotnet/aspnet:8.0-alpine Docker container

Environment

mcr.microsoft.com/dotnet/aspnet:8.0-alpine Docker container running on x64.

github-actions[bot] commented 3 months ago

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @xgithubtriage.

amnguye commented 2 months ago

Duplicate of https://github.com/Azure/azure-sdk-for-net/issues/45052

amnguye commented 2 months ago

We released a patch release to fix this issue. Please upgrade accordingly.

https://www.nuget.org/packages/Azure.Storage.Common/12.20.1 https://www.nuget.org/packages/Azure.Storage.Blobs/12.21.1 https://www.nuget.org/packages/Azure.Storage.Files.DataLake/12.19.1 https://www.nuget.org/packages/Azure.Storage.Queues/12.19.1 https://www.nuget.org/packages/Azure.Storage.Files.Shares/12.19.1