I have noticed that this method:
public override async Task WriteFileAsync(string virtualPath, Stream contents, bool overwrite = false, CancellationToken cancellationToken = default)
{
if (!overwrite && await FileExistsAsync(virtualPath, cancellationToken))
{
throw new FileExistsException(GetPath(virtualPath), Prefix);
}
var path = GetPath(virtualPath);
try
{
contents.Seek(0, SeekOrigin.Begin);
await client.UploadBlobAsync(path, contents, cancellationToken);
}
catch (Exception exception)
{
throw Exception(exception);
}
}
Always throws an Exception if the Blob already Exists. Even though overwrite is true.
Azure Blob Storage suggests not to use the BlobContainerClient.UploadBlobAsync() method when trying to overwrite an existing Blob:

Insted something like this works:
public override async Task WriteFileAsync(
string virtualPath,
Stream contents,
bool overwrite = false,
CancellationToken cancellationToken = new CancellationToken())
{
var path = this.GetPath(virtualPath);
var blobClient = this.containerClient.GetBlobClient(path);
if (!overwrite && await blobClient.ExistsAsync(cancellationToken))
{
throw new FileExistsException(this.GetPath(virtualPath), this.Prefix);
}
try
{
contents.Seek(0, SeekOrigin.Begin);
await blobClient.UploadAsync(contents, overwrite: overwrite, cancellationToken);
}
catch (Exception exception)
{
throw this.Exception(exception);
}
}
Calling the Upload method on the BlobClient.
I have noticed that this method:
Always throws an Exception if the Blob already Exists. Even though overwrite is
true.Azure Blob Storage suggests not to use the

BlobContainerClient.UploadBlobAsync()method when trying to overwrite an existing Blob:Insted something like this works:
Calling the Upload method on the BlobClient.