Upload of video file to Azure works in UWP but fails in Android.

WillAutioItrax 201 Reputation points
2022-01-17T18:00:35.517+00:00

The following snippet of code shows the key lines of interest.
This part of the Xamarin Forms app records a short video and then uploads it to Azure.

    string storageConnectionString = GetStorageConnectionString();

    BlobServiceClient client;
    BlobContainerClient containerClient;
    BlobClient blobClient;

    client = new BlobServiceClient(storageConnectionString);              //   <==
    containerClient = client.GetBlobContainerClient(containerName);
    blobClient = containerClient.GetBlobClient(full_filename);

    await blobClient.UploadAsync(photo.PhotoPath, true);

The code works for UWP but not for Android. In Android, at the new BlobServiceClient line, it throws the exception:

[0:] Helpers: VideoToAzureAsync 1: System.TypeInitializationException: The type initializer for 'Azure.Core.Pipeline.LoggingPolicy' threw an exception. ---> System.TypeInitializationException: The type initializer for 'Azure.Core.Diagnostics.AzureCoreEventSource' threw an exception. ---> System.NotImplementedException: The method or operation is not implemented.
  at System.Diagnostics.Tracing.EventSource.GetSources () [0x00000] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/mcs/class/corlib/System.Diagnostics.Tracing/EventSource.cs:318 
  at Azure.Core.Diagnostics.AzureEventSource.DeduplicateName (System.String eventSourceName) [0x00010] in <0aa90fe0646d47bc95bff520717dbf16>:0 
  at Azure.Core.Diagnostics.AzureEventSource..ctor (System.String eventSourceName) [0x00000] in <0aa90fe0646d47bc95bff520717dbf16>:0 
  at Azure.Core.Diagnostics.AzureCoreEventSource..ctor () [0x00000] in <0aa90fe0646d47bc95bff520717dbf16>:0 
  at Azure.Core.Diagnostics.AzureCoreEventSource..cctor () [0x00000] in <0aa90fe0646d47bc95bff520717dbf16>:0 
   --- End of inner exception stack trace ---
  at Azure.Core.Pipeline.LoggingPolicy..cctor () [0x00000] in <0aa90fe0646d47bc95bff520717dbf16>:0 
   --- End of inner exception stack trace ---
  at Azure.Core.Pipeline.HttpPipelineBuilder.Build (Azure.Core.ClientOptions options, Azure.Core.Pipeline.HttpPipelinePolicy[] perCallPolicies, Azure.Core.Pipeline.HttpPipelinePolicy[] perRetryPolicies, Azure.Core.ResponseClassifier responseClassifier) [0x00164] in <0aa90fe0646d47bc95bff520717dbf16>:0 
  at Azure.Storage.StorageClientOptions.Build (Azure.Core.ClientOptions options, Azure.Core.Pipeline.HttpPipelinePolicy authentication, System.Uri geoRedundantSecondaryStorageUri) [0x00047] in <c72fa900af9245ba84d9b46de33aad4f>:0 
  at Azure.Storage.Blobs.BlobClientOptions.Build (Azure.Core.Pipeline.HttpPipelinePolicy authentication) [0x00008] in <c72fa900af9245ba84d9b46de33aad4f>:0 
  at Azure.Storage.Blobs.BlobServiceClient..ctor (System.String connectionString, Azure.Storage.Blobs.BlobClientOptions options) [0x00036] in <c72fa900af9245ba84d9b46de33aad4f>:0 
  at Azure.Storage.Blobs.BlobServiceClient..ctor (System.String connectionString) [0x00000] in <c72fa900af9245ba84d9b46de33aad4f>:0 
  at i_TraxMobile.Helpers.Util.VideoToAzureAsync (i_TraxMobile.Models.Photo photo) [0x0019e] in <91d1da5f7c2941eb85ecbcf56559f8dc>:0 . 

What does this exception mean?
Why would it be thrown in Android and not UWP?

Thanks!

Not Monitored
Not Monitored
Tag not monitored by Microsoft.
35,781 questions
{count} votes