Calling `UploadFromStreamAsync` for a blob from `WindowsAzure.Storage` ends at the end with:
Microsoft.WindowsAzure.Storage.StorageException: Object reference not set to an
instance of an object ---> System.NullReferenceException: Object reference not s
et to an instance of an object
at System.Net.WebConnectionStream.EndRead (IAsyncResult r) [0x00007] in C:\j\w
at Microsoft.WindowsAzure.Storage.Core.ByteCountingStream.EndRead (IAsyncResul
t asyncResult) <0x5d09060 + 0x0001a> in <filename unknown>:0
ead () <0x5cfdad0 + 0x0002d> in <filename unknown>:0
n (IAsyncResult res) <0x5cfcf30 + 0x00053> in <filename unknown>:0
tch (IAsyncResult res) <0x5cfcc88 + 0x00063> in <filename unknown>:0
--- End of inner exception stack trace ---
at Microsoft.WindowsAzure.Storage.Core.Util.StorageAsyncResult`1[T].End () <0x
5d0f710 + 0x0003f> in <filename unknown>:0
at Microsoft.WindowsAzure.Storage.Blob.CloudBlockBlob.EndUploadFromStream (IAs
yncResult asyncResult) <0x5d0f6c8 + 0x0002f> in <filename unknown>:0
.<CreateCallbackVoid>b__3 (IAsyncResult ar) <0x5d0f488 + 0x00095> in <filename u
Works fine on MS.NET.
Could you provide a test case that shows this behavior? It will be very hard for us to figure out what's going on based just on this stack trace.
This is the simplest I can get it:
public static async Task UploadDataAsync(Stream stream, string name)
stream.Position = 0;
var blob = CreateBlobReference(name);
var uploadOptions = new BlobRequestOptions()
ServerTimeout = TimeSpan.FromMinutes(6),
RetryPolicy = new ExponentialRetry(TimeSpan.FromSeconds(2), 3),
DisableContentMD5Validation = false,
StoreBlobContentMD5 = true,
UseTransactionalMD5 = true,
uploadOptions.SingleBlobUploadThresholdInBytes = 4 * 1024 * 1024;
uploadOptions.ParallelOperationThreadCount = 2;
Fails on Windows as well as Arch Linux (on ARM).
It looks like support for Xamarin is in preview in the WindowsAzure.Storage package.
"Portable Class Library Profile 111: Storage Client Libraries are available to support building PCL Profile 111 applications, as well as for Xamarin application development. This support is currently in preview."
So this may be an UPSTREAM issue?
It looks like this issue is already filed on the github repo:
I guess that the problem is two-fold. The mono side problem is, that the async upload blocks (i.e. never finishes until a timeout is triggered, mono problem) which causes the NRE in the azure library (azure library problem). Using the non-async methods fixes this problem for me, because the upload doesn't get blocked any more.