I was able to recreate the problem you are facing. This happens if the Content MD5 blob property is somehow damaged. I had a blob with some MD5 content (that was correct). Then I programmatically changed MD5 to a different value (which is wrong). Now, when I call the DownloadToStream () method in the blob, I get exactly the same error.
You can work around this check by setting DisableContentMD5Validation to true in BlobRequestOptions , as shown in the code below:
BlobRequestOptions options = new BlobRequestOptions() { DisableContentMD5Validation = true, }; blockBlob.DownloadToStream(memoryStream, null, options);
Try it and it should work.
On a side note, you can change your ReadFully method. You will need to move the input stream pointer to the beginning.
public static byte[] ReadFully(Stream input) { input.Position = 0;
Gaurav mantri
source share