Since Microsoft.Azure.Storage.File is deprecated we are trying to upgrade to Azure.Storage.Files.Shares.
We were able to port our existing code to read files from the file share, but we are not being able to save changes to an existing file.
Using "Microsoft.Azure.Storage.File" we'd pass a stream to CloudFile.UploadFromStreamAsync and it would work as expected.
In "Azure.Storage.Files.Shares" we've tried to use both ShareFileClient.OpenWriteAsync and ShareFileClient.UploadAsync with no succes.
//This seems to empty the file
public void SaveStream(Stream stream)
{
var openOptions = new ShareFileOpenWriteOptions() { MaxSize = stream.Length + 1 };
using (var fileStream = File.OpenWrite(true, 0, openOptions))
{
stream.CopyToAsync(fileStream);
}
}
//This corrupts the file (it seems like it appends to it)
public void SaveStream(Stream stream)
{
File.UploadAsync(stream);
}
stream is a MemoryStream, File is an instance of ShareFileClient. We're on .NET Standard 2.0.
Anyone with more experience with this, that could shine some more light on the subject?