Azure / azure-storage-net-data-movement

Azure Storage Data Movement Library for .Net
MIT License
275 stars 133 forks source link

Xamarin.Form fails to resolve Mono.Posix.NETStandard for iOS #201

Open NordAlex opened 4 years ago

NordAlex commented 4 years ago

This is the build issue connected to Xamarin Forms for iOS platform. Does this library suppose to support Xamarin platform?

Which version of the SDK was used?

Microsoft.Azure.Storage.DataMovement 1.2.0

On which platform were you using? (.Net Framework version or .Net Core version, and OS version)

Xamarin Forms, iOS.

How can the problem be reproduced? It'd be better if the code caused the problem can be shared.

  1. Create a new Xamarin.Forms project.
  2. Install Microsoft.Azure.Storage.DataMovemet package
  3. Try to write/read file/blob from azure. (you can run the sample from this repo)
  4. Get build error connected to resolving 'Mono.Posix.NETStandard, Version=1.0.0.0

Mono.Linker.LoadException: Error while processing references of 'TestAzure.iOS, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' ---> Mono.Linker.LoadException: Error while processing references of 'TestAzure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' ---> Mono.Cecil.AssemblyResolutionException: Failed to resolve assembly: 'Mono.Posix.NETStandard, Version=1.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' ---> Mono.Cecil.AssemblyResolutionException: Failed to resolve assembly: 'Mono.Posix.NETStandard, Version=1.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'

EmmaZhu commented 4 years ago

Hi @NordAlex ,

Technically, DMLib can be executed on all SDK/platforms follows .NET Standard 2.0. Table in this link shows platforms and supported .NET standard version. Not sure whether Xamarin.IOS is one for Xamarin.Forms?

We never tried on Xamarin.Forms. I'd need more investigation to give more detailed answers.

Thanks Emma

EmmaZhu commented 4 years ago

Hi @NordAlex ,

I tried:

  1. create a Xamarin.Forms project as following: image

  2. Install Microsoft.Azure.Storage.DataMovement package in the iOS project

I can build the project successfully. I don't have a Mac/iPhone, so I didn't try with running it. Seems it can pass build.

Thanks Emma

NordAlex commented 4 years ago

@EmmaZhu It is not enough just to add the library. If the app does not have references to the package - linker will not include external lib. I Have prepared a sample for you. Could you try to build this one? You can see code that I include in MainPage.xaml.cs file(It is just a copy-pasted sample). DM.Test.zip

EmmaZhu commented 4 years ago

Hi @NordAlex ,

I tried with the sample code you shared. I can successfully build the projects. When I try to debug it, it's always pending on creating a virtual Android device. I'm using VS 2019. Not sure whether this is an issue in VS 2019.

DMLib only uses Mono.Posix package to resolving symbolic links. For DMLib is an open-sourced project, if you cannot resolve the build issue, I think you can directly delete following code in file "lib\TransferEnumerators\EnumerateDirectoryHelper.cs", remove the Mono.Posix package and build your own DMLib.

                            if (CrossPlatformHelpers.IsLinux)
                            {
                                fileEntryInfo = GetFileEntryInfo(filePath);
                            }

Solution DataMovement_k.sln is used to build Net Standard library.

Thanks Emma

petro2050 commented 3 years ago

I have the same issue in Android when using a Xamarin Forms project.