title: Exception when creating blob asyncronously with Azure Storage - UploadTextAsync
body: <p>In our project, we were using the Azure Storage 6.0.0 version and we were making use of the <code>UploadTextAsync</code> method to create blobs. After updating to the latest version, the UploadTextAsync function stopped working and now it throws an exception: </p>
  
  <blockquote>
    <p>"Object reference not set to an instance of an object."</p>
  </blockquote>
  
  <p>I've tried different methods to replace it but all throw the same exception. For example:</p>
  
  <pre><code>byte[] fileBytes = Encoding.UTF8.GetBytes(data);
  await lockBlob.UploadFromByteArrayAsync(fileBytes, 0, fileBytes.Length);
  </code></pre>
  
  <p>The only way I made it work was to change to the synchronous version:</p>
  
  <pre><code>BlobRequestOptions blobOptions = new BlobRequestOptions
  {
           MaximumExecutionTime = TimeSpan.FromSeconds(5),
  };
  lockBlob.UploadText(data, null, null, blobOptions, null);
  </code></pre>
  
  <p>How can I make the async version work? Is there a workaround? I really need the async version.</p>
  
  <p>The UploadText (async and sync) method creates the blob if it doesn't already exist, and overwrites it if it does.</p>
  
  <p>Why does it work with the sync version and not the async with the update?</p>
  
  <p>For the blob creation this is the code:</p>
  
  <pre><code>var container= client.GetContainerReference("lockblobs");
  await container.CreateIfNotExistsAsync();
  var lockBlob = container.GetBlockBlobReference(data);
  </code></pre>