question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[QUERY] BlockBlobClient.OpenWriteAsync with overwrite: false

See original GitHub issue

Query/Question If I call BlockBlobClient.OpenWriteAsync(overwrite: false) I get 'System.ArgumentException' in System.Private.CoreLib.dll: 'BlockBlobClient.OpenWrite only supports overwriting'. Why can’t I set overwrite to false? If I set overwrite: true and then set options: new BlockBlobOpenWriteOptions { OpenConditions = new BlobRequestConditions { IfNoneMatch = new ETag("*") } } it seems to behave as it should, throwing an exception if I try to open a blob that already exists.

Environment:

  • Name and version of the Library package used: Azure.Storage.Blobs 12.10.0
  • Hosting platform or OS and .NET runtime version (dotnet --info output for .NET Core projects): Windows 10 .NET 5

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
jesperkristensencommented, Oct 22, 2021

Ok, thanks. I thought of that, but then dismissed it because it seemed so inconsistent with the rest of the use of the word “overwrite” in the API, and because the API docs did not say that it is what it meant. When re-reading it after your message, I can see the docs could mean both things “Whether an existing blob should be deleted and recreated.”

0reactions
woutervanranstcommented, Dec 1, 2021

Note: this workaround is not fool proof for Archived blobs – if you’re catching a 409 BlobAlreadyExists, in case of an archived blob it throws a 409 BlobArchived

Read more comments on GitHub >

github_iconTop Results From Across the Web

c# - How to set overwrite in Azure BlobClient when using ...
To perform a partial update of the content of a block blob, use the Azure.Storage.Blobs.Specialized.BlockBlobClient.StageBlock(System.String, ...
Read more >
BlockBlobClient streaming API generates incorrect content ...
BlockBlobClient streaming API generates incorrect content hash [BUG] #16779 ... OpenWriteAsync(overwrite: true, options: options);.
Read more >
BlockBlobClient.OpenWriteAsync Method - Storage
Opens a stream for writing to the blob. If the blob exists, it will be overwritten.
Read more >
Class BlockBlobClient | Azure SDK for .NET
The BlockBlobClient allows you to manipulate Azure Storage block blobs. ... Stream> OpenWriteAsync (bool overwrite, ... The default value is false. System.
Read more >
Untitled
Blockblobclient openwriteasync Webpublic async Task BlockBlobWriteStreamOpenWithAccessConditionAsync () { CloudBlobContainer container ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found