Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I can't reproduce what you're seeing. Things seem to work as expected:</p> <pre><code>static void Main(string[] args) { // I also tried a real cloud storage account. Same result. var container = CloudStorageAccount.DevelopmentStorageAccount.CreateCloudBlobClient().GetContainerReference("testcontainer"); container.CreateIfNotExist(); var blob = container.GetBlobReference("testblob.txt"); blob.UploadText(new String('x', 5000000)); var source = blob.OpenRead(); int BUFFER_SIZE = 4000000; byte[] buffer = new byte[BUFFER_SIZE]; int bytesRead; int bytesCopied = 0; do { bytesRead = source.Read(buffer, 0, BUFFER_SIZE); bytesCopied += bytesRead; } while (bytesRead &gt; 0); Console.WriteLine(bytesCopied); // prints 5000000 } </code></pre> <p>EDIT:</p> <p>I've also (in response to the edited question) now tried uploading the blob using OpenWrite, and the result is the same. (I get the full blob back.) I used this code in place of blob.UploadText(...):</p> <pre><code>using (var input = File.OpenRead(@"testblob.txt")) //5000000 bytes using (var output = blob.OpenWrite()) { input.CopyTo(output); } </code></pre> <p>The final WriteLine still prints 5000000.</p> <p>EDIT 2:</p> <p>This is getting a bit tiresome. Changing the BUFFER_SIZE to 65536 didn't change anything. The results still seem correct to me. Here's my full application for comparison:</p> <pre><code>static void Main(string[] args) { // I also tried a real cloud storage account. Same result. var container = CloudStorageAccount.DevelopmentStorageAccount.CreateCloudBlobClient().GetContainerReference("testcontainer"); container.CreateIfNotExist(); var blob = container.GetBlobReference("testblob.txt"); using (var input = File.OpenRead(@"testblob.txt")) //5000000 bytes using (var output = blob.OpenWrite()) { input.CopyTo(output); } var source = blob.OpenRead(); int BUFFER_SIZE = 65536; byte[] buffer = new byte[BUFFER_SIZE]; int bytesRead; int bytesCopied = 0; do { bytesRead = source.Read(buffer, 0, BUFFER_SIZE); bytesCopied += bytesRead; } while (bytesRead &gt; 0); Console.WriteLine(bytesCopied); // prints 5000000 } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload