You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Aug 1, 2024. It is now read-only.
Which service(blob, file, queue, table) does this issue concern?
Blob
Which version of the SDK was used?
9.3
Which platform are you using? (ex: .NET Core 2.1)
Net Core 2.1
What problem was encountered?
An exception (parameter cannot be empty string) when calling blobReference.SetMetadataAsync() to set blob metadata to the dictionary that I set on the blob reference.
if the value of the parameter is null or empty string, an exception is thrown:
Microsoft.WindowsAzure.Storage.StorageException: The argument must not be empty string. ---> System.ArgumentException: The argument must not be empty string.
at Microsoft.WindowsAzure.Storage.Shared.Protocol.HttpRequestMessageFactory.AddMetadata(StorageRequestMessage request, String name, String value)
at Microsoft.WindowsAzure.Storage.Shared.Protocol.HttpRequestMessageFactory.AddMetadata(StorageRequestMessage request, IDictionary2 metadata) at Microsoft.WindowsAzure.Storage.Blob.CloudBlob.<>c__DisplayClass135_0.<SetMetadataImpl>b__0(RESTCommand1 cmd, Uri uri, UriQueryBuilder builder, HttpContent cnt, Nullable1 serverTimeout, OperationContext ctx) at Microsoft.WindowsAzure.Storage.Core.Executor.Executor.ExecuteAsyncInternal[T](RESTCommand1 cmd, IRetryPolicy policy, OperationContext operationContext, CancellationToken token)
--- End of inner exception stack trace ---
at Microsoft.WindowsAzure.Storage.Core.Executor.Executor.ExecuteAsyncInternal[T](RESTCommand`1 cmd, IRetryPolicy policy, OperationContext operationContext, CancellationToken token)
How can we reproduce the problem in the simplest way?
Get a cloud blob blob reference and call:
blobReference.Metadata.Add("PropertyName", null);
blobReference.SetMetadataAsync();
it checks for the value being null but should be checking the name for null instead. It later goes on to construct the header name from the name so clearly was intended to check the name rather than value
The text was updated successfully, but these errors were encountered:
Is there any update on this? This issue was reported almost 3 years ago and a PR was put in over a year ago to fix. Can we get that PR pushed through so I no longer have to check string.IsNullOrEmpty() every time I add metadata to a blob?
Which service(blob, file, queue, table) does this issue concern?
Blob
Which version of the SDK was used?
9.3
Which platform are you using? (ex: .NET Core 2.1)
Net Core 2.1
What problem was encountered?
An exception (parameter cannot be empty string) when calling blobReference.SetMetadataAsync() to set blob metadata to the dictionary that I set on the blob reference.
I set the metadata properties like this
blobReference.Metadata.Add("PropertyName", value);
if the value of the parameter is null or empty string, an exception is thrown:
Microsoft.WindowsAzure.Storage.StorageException: The argument must not be empty string. ---> System.ArgumentException: The argument must not be empty string.
at Microsoft.WindowsAzure.Storage.Shared.Protocol.HttpRequestMessageFactory.AddMetadata(StorageRequestMessage request, String name, String value)
at Microsoft.WindowsAzure.Storage.Shared.Protocol.HttpRequestMessageFactory.AddMetadata(StorageRequestMessage request, IDictionary
2 metadata) at Microsoft.WindowsAzure.Storage.Blob.CloudBlob.<>c__DisplayClass135_0.<SetMetadataImpl>b__0(RESTCommand
1 cmd, Uri uri, UriQueryBuilder builder, HttpContent cnt, Nullable1 serverTimeout, OperationContext ctx) at Microsoft.WindowsAzure.Storage.Core.Executor.Executor.ExecuteAsyncInternal[T](RESTCommand
1 cmd, IRetryPolicy policy, OperationContext operationContext, CancellationToken token)--- End of inner exception stack trace ---
at Microsoft.WindowsAzure.Storage.Core.Executor.Executor.ExecuteAsyncInternal[T](RESTCommand`1 cmd, IRetryPolicy policy, OperationContext operationContext, CancellationToken token)
How can we reproduce the problem in the simplest way?
Get a cloud blob blob reference and call:
blobReference.Metadata.Add("PropertyName", null);
blobReference.SetMetadataAsync();
or
blobReference.Metadata.Add("PropertyName", "");
blobReference.SetMetadataAsync();
Have you found a mitigation/solution?
I believe this is a bug the the code here: https://github.com/Azure/azure-storage-net/blob/master/Lib/Common/Shared/Protocol/HttpRequestMessageFactory.cs#L203
it checks for the value being null but should be checking the name for null instead. It later goes on to construct the header name from the name so clearly was intended to check the name rather than value
The text was updated successfully, but these errors were encountered: