phillipsj/Cake.AzureStorage

UploadFileToBlob fails on mono

Opened this issue · 8 comments

When using UploadFileToBlob with mono 4.8.0 it fails unconditionally uploading a blob.

I saw that the Windows Azure SDK being used is 7.2.1, can we maybe upgrade to latest version?

Failed to upload blob Microsoft.WindowsAzure.Storage.StorageException: Object reference not set to an instance of an object ---> System.NullReferenceException: Object reference not set to an instance of an object
  at System.Net.WebConnectionStream.EndRead (System.IAsyncResult r) [0x00007] in <f8255d9ef0594d18ae2c0d97286b9a80>:0 
  at Microsoft.WindowsAzure.Storage.Core.ByteCountingStream.EndRead (System.IAsyncResult asyncResult) [0x00000] in <544a9ba722b44caeb057c21d78b258ff>:0 
  at Microsoft.WindowsAzure.Storage.Core.Util.AsyncStreamCopier`1[T].ProcessEndRead () [0x00012] in <544a9ba722b44caeb057c21d78b258ff>:0 
  at Microsoft.WindowsAzure.Storage.Core.Util.AsyncStreamCopier`1[T].EndOperation (System.IAsyncResult res) [0x00016] in <544a9ba722b44caeb057c21d78b258ff>:0 
  at Microsoft.WindowsAzure.Storage.Core.Util.AsyncStreamCopier`1[T].EndOpWithCatch (System.IAsyncResult res) [0x00023] in <544a9ba722b44caeb057c21d78b258ff>:0 
   --- End of inner exception stack trace ---
  at Microsoft.WindowsAzure.Storage.Blob.BlobWriteStream.Flush () [0x00018] in <544a9ba722b44caeb057c21d78b258ff>:0 
  at Microsoft.WindowsAzure.Storage.Blob.BlobWriteStream.Commit () [0x00000] in <544a9ba722b44caeb057c21d78b258ff>:0 
  at Microsoft.WindowsAzure.Storage.Blob.BlobWriteStream.Dispose (System.Boolean disposing) [0x00025] in <544a9ba722b44caeb057c21d78b258ff>:0 
  at System.IO.Stream.Close () [0x00000] in <f712f98eb8e445c8918edaf595bbe465>:0 
  at System.IO.Stream.Dispose () [0x00000] in <f712f98eb8e445c8918edaf595bbe465>:0 
  at Microsoft.WindowsAzure.Storage.Blob.CloudBlockBlob.UploadFromStreamHelper (System.IO.Stream source, System.Nullable`1[T] length, Microsoft.WindowsAzure.Storage.AccessCondition accessCondition, Microsoft.WindowsAzure.Storage.Blob.BlobRequestOptions options, Microsoft.WindowsAzure.Storage.OperationContext operationContext) [0x002aa] in <544a9ba722b44caeb057c21d78b258ff>:0 
  at Microsoft.WindowsAzure.Storage.Blob.CloudBlockBlob.UploadFromStream (System.IO.Stream source, Microsoft.WindowsAzure.Storage.AccessCondition accessCondition, Microsoft.WindowsAzure.Storage.Blob.BlobRequestOptions options, Microsoft.WindowsAzure.Storage.OperationContext operationContext) [0x00000] in <544a9ba722b44caeb057c21d78b258ff>:0 
  at Microsoft.WindowsAzure.Storage.Blob.CloudBlockBlob.UploadFromFile (System.String path, Microsoft.WindowsAzure.Storage.AccessCondition accessCondition, Microsoft.WindowsAzure.Storage.Blob.BlobRequestOptions options, Microsoft.WindowsAzure.Storage.OperationContext operationContext) [0x00014] in <544a9ba722b44caeb057c21d78b258ff>:0 
  at Cake.AzureStorage.AzureStorage.UploadFileToBlob (Cake.AzureStorage.AzureStorageSettings settings, Cake.Core.IO.FilePath fileToUpload) [0x00054] in <544a9ba722b44caeb057c21d78b258ff>:0 
  at Cake.AzureStorage.AzureStorageAlias.UploadFileToBlob (Cake.Core.ICakeContext context, Cake.AzureStorage.AzureStorageSettings settings, Cake.Core.IO.FilePath fileToUpload) [0x00011] in <544a9ba722b44caeb057c21d78b258ff>:0 
  at CakeBuildScriptImpl.UploadFileToBlob (Cake.AzureStorage.AzureStorageSettings settings, Cake.Core.IO.FilePath fileToUpload) [0x00006] in <3676900831544f399b71fe567b901541>:0 
  at CakeBuildScriptImpl+<Execute>c__AnonStorey2.<>m__0 () [0x001a5] in <3676900831544f399b71fe567b901541>:0 
Request Information
RequestID:975a3863-0001-0018-6a2d-98ec26000000
RequestDate:Wed, 08 Mar 2017 16:59:29 GMT
StatusMessage:Created

We can reopen if it doesn't fix it.

Unfortunately upgrading to 8.1.1 doesn't seem to have fixed it.

I have created an issue in the Azure Storage SDK repo: Azure/azure-storage-net#424

Looks like the Azure Storage SDK folks are punting this back to here with this claim:

Looking at Cake.AzureStorage it is referencing the Net45 target for AzureStorage while it should be using the Netstandard version of our library to run on mono.

I'll go ahead and reopen this, I'll try and take a look at it when I get a free minute and have one of you guys test it out on mono.

I am up for giving it a spin.

@Cheesebaron this is yours. I have a few things that need to got out and we can just add this to the list. Please do it in a feature branch on develop. Thanks for offering, we have a lot going on and I have a new little one at home so it would have been at least until next week.

I think I will have time to revisit this soon-ish. This way we can update to latest Azure Storage SDK too.