locked
Uploadfromstream not working. Missing implementation in library. RRS feed

  • Question

  • Hi guys,

    I need help with the following error. I tried to use the UploadFromStreamAsync and UploadFromByteArrayAsync methods but they both throw an exception.

    System.NotImplementedException: The method or operation is not implemented.
      at System.Security.Cryptography.IncrementalHash.CreateHash (System.Security.Cryptography.HashAlgorithmName hashAlgorithm)

    Any suggestions?

    Thnks!

    Wednesday, January 4, 2017 8:48 AM

Answers

  • Thanks for reporting this issue @andrisbandris.

    We found out that Xamarin does not implement the Hashing algorithm our netstandard library is using although netstandard supports it. This is actually being thrown from Xamarin Runtime.

    We are in the process of providing a fix and involving folks from Xamarin.

    This issue will affect all APIs that required stream operations. We are working to fix this issue as soon as possible, meanwhile please use 7.2.1 as a workaround. We will update on GitHub(https://github.com/Azure/azure-storage-net/issues/387) once the fix is out.

    Thanks again for reporting this!

    Elham

    • Marked as answer by andrisbandris Monday, January 9, 2017 10:39 AM
    Friday, January 6, 2017 12:05 AM
  • The issue with the above stack trace has recently been introduced with 8.0.0 so I would suggest a clean build and deployment. Please let us know if that does not fix the issue.

    Thanks,

    Elham

    • Marked as answer by andrisbandris Monday, January 9, 2017 10:39 AM
    Sunday, January 8, 2017 8:16 PM
  • Thanks for your suggestion! I reinstalled 7.2.1 and ALL dependencies and then rebuilt the solution after cleaning it and now it works.

    Thanks again I appreciate your help!

    • Marked as answer by andrisbandris Monday, January 9, 2017 10:39 AM
    Monday, January 9, 2017 10:38 AM

All replies

  • Hi,

    Thank you for contacting Microsoft forums. We are pleased to answer your query.

    1. If you can provide a bit more context into this, that would be helpful. What service is this in reference to?
    2. What are you trying to achieve?
    3. May I know where did you observe this error?


    Regards,
    Sumanth BM


    Wednesday, January 4, 2017 6:58 PM
  • Hi,

    I am using the WindowsAzure.Storage library and I would like to upload a file into a blob. I tried to achieve it by opening the file as a stream and then using the methods named above. When I get to these methods they throw this exception.

    I have the newest version of WindowsAzure.Storage and all this is in a Xamarin Android project.

    Thanks!

    Wednesday, January 4, 2017 8:19 PM
  • Hi,

    Thank you for contacting Microsoft forums. We are pleased to answer your query.

    We are checking on the query and will get back to you soon on this.

    I apologize for the inconvenience and appreciate your time and patience in this matter.

    Regards
    Sumanth BM
    Thursday, January 5, 2017 2:29 PM
  • Hi @andrisbandris,

    Are you using a PCL? Would you please share the project structure as well as exact project template you are using?

    Thanks,

    Elham

    Thursday, January 5, 2017 6:04 PM
  • Hi,

    I am not using PCL, at least I think so, because I don't know , what it is...

    I just created a very simple Xamarin Android project and tried to upload a file (I checked the stream and it is not null).

    Here is the full code of MainActivity:

    using System;
    using Android.App;
    using Android.Content;
    using Android.Runtime;
    using Android.Views;
    using Android.Widget;
    using Android.OS;
    using Microsoft.WindowsAzure.Storage;
    using Microsoft.WindowsAzure.Storage.Blob;
    using System.IO;

    namespace App2
    {
        [Activity(Label = "App2", MainLauncher = true, Icon = "@drawable/icon")]
        public class MainActivity : Activity
        {
            int count = 1;

            protected override void OnCreate(Bundle bundle)
            {
                base.OnCreate(bundle);
                // Set our view from the "main" layout resource
                SetContentView(Resource.Layout.Main);
                // Get our button from the layout resource,
                // and attach an event to it
                Button button = FindViewById<Button>(Resource.Id.MyButton);
                button.Click += async (sender, e) =>
                {
                    CloudBlobContainer container = new CloudBlobContainer(new Uri("https://****.blob.core.windows.net/test"));
                    CloudBlockBlob blockBlob;
                    blockBlob = container.GetBlockBlobReference("blobtest.png");
                    using (MemoryStream mem = new MemoryStream())
                    {
                        File.Open("/storage/sdcard0/DCIM/Camera/1449177740098.jpg", FileMode.Open, FileAccess.ReadWrite).CopyTo(mem); 
                        await blockBlob.UploadFromStreamAsync(mem);
                    }
                };
                    
            }
        }
    }

    Thursday, January 5, 2017 7:37 PM
  • Thanks for reporting this issue @andrisbandris.

    We found out that Xamarin does not implement the Hashing algorithm our netstandard library is using although netstandard supports it. This is actually being thrown from Xamarin Runtime.

    We are in the process of providing a fix and involving folks from Xamarin.

    This issue will affect all APIs that required stream operations. We are working to fix this issue as soon as possible, meanwhile please use 7.2.1 as a workaround. We will update on GitHub(https://github.com/Azure/azure-storage-net/issues/387) once the fix is out.

    Thanks again for reporting this!

    Elham

    • Marked as answer by andrisbandris Monday, January 9, 2017 10:39 AM
    Friday, January 6, 2017 12:05 AM
  • Hi,

    Thanks for your answer!

    I also tried Version 7.2.1, but I still get the same error. Do you have any further suggestions?

    Friday, January 6, 2017 11:02 AM
  • The issue with the above stack trace has recently been introduced with 8.0.0 so I would suggest a clean build and deployment. Please let us know if that does not fix the issue.

    Thanks,

    Elham

    • Marked as answer by andrisbandris Monday, January 9, 2017 10:39 AM
    Sunday, January 8, 2017 8:16 PM
  • Thanks for your suggestion! I reinstalled 7.2.1 and ALL dependencies and then rebuilt the solution after cleaning it and now it works.

    Thanks again I appreciate your help!

    • Marked as answer by andrisbandris Monday, January 9, 2017 10:39 AM
    Monday, January 9, 2017 10:38 AM
  • Hi @andrisbandris,

    A hotfix has been released for this issue, please upgrade to 8.0.1(https://www.nuget.org/packages/WindowsAzure.Storage/8.0.1) to resolve.

    Thanks again for reporting!

    Wednesday, January 11, 2017 4:19 AM