繼this文章中,我創建了一個空白Xamarin窗體應用程序,添加了WindowsStorage.Azure
包到PCL和Android應用(我現在已經刪除了iOS和UWP如它只是一個測試APP)實例化CloudStorageAccount在Xamarin應用程序會導致未處理的異常
<package id="WindowsAzure.Storage" version="8.1.1" targetFramework="portable45-net45+win8+wp8+wpa81" />
並試圖與庫進行交互,但只要我做任何事情,該應用程序崩潰與未處理的異常:
無論我做什麼,無論是創建新的對象StorageCredentials:
var creds = new StorageCredentials("something", "other");
或新CloudStorageAccount:
var storageAccount = CloudStorageAccount.Parse(storageConnectionString);
我得到相同。 我已閱讀github documentation,並且看不到此原因。
有沒有人遇到過這個問題,可以幫助解決這裏發生了什麼問題?
編輯:
我可以從它拋出一個NotImplementedException得不窗口中看到:
05-09 14:45:16.452 D/Mono (3772): DllImport attempting to load: '/system/lib/liblog.so'.
05-09 14:45:16.476 D/Mono (3772): DllImport loaded library '/system/lib/liblog.so'.
05-09 14:45:16.476 D/Mono (3772): DllImport searching in: '/system/lib/liblog.so' ('/system/lib/liblog.so').
05-09 14:45:16.476 D/Mono (3772): Searching for '__android_log_print'.
05-09 14:45:16.476 D/Mono (3772): Probing '__android_log_print'.
05-09 14:45:16.476 D/Mono (3772): Found as '__android_log_print'.
05-09 14:45:16.480 I/MonoDroid(3772): UNHANDLED EXCEPTION:
05-09 14:45:16.485 I/MonoDroid(3772): System.AggregateException: One or more errors occurred. ---> System.NotImplementedException: The method or operation is not implemented.
05-09 14:45:16.485 I/MonoDroid(3772): at Microsoft.WindowsAzure.Storage.Auth.StorageCredentials..ctor (System.String accountName, System.String keyValue, System.String keyName) [0x00006] in C:\Program Files (x86)\Jenkins\workspace\release_dotnet_master\Lib\AspNet\Microsoft.WindowsAzure.Storage.Facade\FacadeLib\Microsoft.WindowsAzure.Storage.Auth.StorageCredentials.cs:77
05-09 14:45:16.485 I/MonoDroid(3772): at Microsoft.WindowsAzure.Storage.Auth.StorageCredentials..ctor (System.String accountName, System.String keyValue) [0x00000] in C:\Program Files (x86)\Jenkins\workspace\release_dotnet_master\Lib\AspNet\Microsoft.WindowsAzure.Storage.Facade\FacadeLib\Microsoft.WindowsAzure.Storage.Auth.StorageCredentials.cs:71
05-09 14:45:16.485 I/MonoDroid(3772): at TestApp.Droid.MainPage+<StartPolling>d__3.MoveNext() [0x0001d] in D:\XamarinAzureStorageTest\TestApp.Droid\TestApp.Droid\MainPage.xaml.cs:27
05-09 14:45:16.485 I/MonoDroid(3772): --- End of inner exception stack trace ---
05-09 14:45:16.485 I/MonoDroid(3772): at System.Threading.Tasks.Task.ThrowIfExceptional (System.Boolean includeTaskCanceledExceptions) [0x00014] in /Users/builder/data/lanes/4468/f913a78a/source/mono/mcs/class/referencesource/mscorlib/system/threading/Tasks/Task.cs:2157
05-09 14:45:16.485 I/MonoDroid(3772): at System.Threading.Tasks.Task.Wait (System.Int32 millisecondsTimeout, System.Threading.CancellationToken cancellationToken) [0x00052] in /Users/builder/data/lanes/4468/f913a78a/source/mono/mcs/class/referencesource/mscorlib/system/threading/Tasks/Task.cs:3189
05-09 14:45:16.485 I/MonoDroid(3772): at System.Threading.Tasks.Task.Wait() [0x00000] in /Users/builder/data/lanes/4468/f913a78a/source/mono/mcs/class/referencesource/mscorlib/system/threading/Tasks/Task.cs:3054
05-09 14:45:16.485 I/MonoDroid(3772): at TestApp.Droid.MainPage.StartPolling_Clicked (System.Object sender, System.EventArgs e) [0x0004e] in D:\XamarinAzureStorageTest\TestApp.Droid\TestApp.Droid\MainPage.xaml.cs:55
05-09 14:45:16.485 I/MonoDroid(3772): at Xamarin.Forms.Button.Xamarin.Forms.IButtonController.SendClicked() [0x00020] in C:\BuildAgent\work\ca3766cfc22354a1\Xamarin.Forms.Core\Button.cs:125
05-09 14:45:16.485 I/MonoDroid(3772): at Xamarin.Forms.Platform.Android.AppCompat.ButtonRenderer+ButtonClickListener.OnClick (Android.Views.View v) [0x0000b] in C:\BuildAgent\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\AppCompat\ButtonRenderer.cs:298
05-09 14:45:16.485 I/MonoDroid(3772): at Android.Views.View+IOnClickListenerInvoker.n_OnClick_Landroid_view_View_ (System.IntPtr jnienv, System.IntPtr native__this, System.IntPtr native_v) [0x00011] in /Users/builder/data/lanes/4468/b16fb820/source/monodroid/src/Mono.Android/platforms/android-23/src/generated/Android.Views.View.cs:1806
05-09 14:45:16.485 I/MonoDroid(3772): at (wrapper dynamic-method) System.Object:0f149978-de2e-4679-a635-699ceeddec42 (intptr,intptr,intptr)
05-09 14:45:16.485 I/MonoDroid(3772): ---> (Inner Exception #0) System.NotImplementedException: The method or operation is not implemented.
05-09 14:45:16.485 I/MonoDroid(3772): at Microsoft.WindowsAzure.Storage.Auth.StorageCredentials..ctor (System.String accountName, System.String keyValue, System.String keyName) [0x00006] in C:\Program Files (x86)\Jenkins\workspace\release_dotnet_master\Lib\AspNet\Microsoft.WindowsAzure.Storage.Facade\FacadeLib\Microsoft.WindowsAzure.Storage.Auth.StorageCredentials.cs:77
05-09 14:45:16.485 I/MonoDroid(3772): at Microsoft.WindowsAzure.Storage.Auth.StorageCredentials..ctor (System.String accountName, System.String keyValue) [0x00000] in C:\Program Files (x86)\Jenkins\workspace\release_dotnet_master\Lib\AspNet\Microsoft.WindowsAzure.Storage.Facade\FacadeLib\Microsoft.WindowsAzure.Storage.Auth.StorageCredentials.cs:71
05-09 14:45:16.485 I/MonoDroid(3772): at TestApp.Droid.MainPage+<StartPolling>d__3.MoveNext() [0x0001d] in D:\XamarinAzureStorageTest\TestApp.Droid\TestApp.Droid\MainPage.xaml.cs:27 <---
05-09 14:45:16.500 W/art (3772): JNI RegisterNativeMethods: attempt to register 0 native methods for android.runtime.JavaProxyThrowable
05-09 14:45:16.604 D/Mono (3772): DllImport searching in: '__Internal' ('(null)').
05-09 14:45:16.604 D/Mono (3772): Searching for 'java_interop_jnienv_throw'.
05-09 14:45:16.604 D/Mono (3772): Probing 'java_interop_jnienv_throw'.
05-09 14:45:16.604 D/Mono (3772): Found as 'java_interop_jnienv_throw'.
Thread finished: <Thread Pool> #4
The thread 'Unknown' (0x4) has exited with code 0 (0x0).
Thread finished: <Thread Pool> #5
05-09 14:45:57.900 D/Mono (3772): [0x9b2de930] worker finishingThe thread 'Unknown' (0x5) has exited with code 0 (0x0).
嘗試查看調試/輸出窗口以獲取有關該錯誤的更多信息。有時你需要點擊「繼續」才能顯示。但是瘋狂猜測(沒有更多信息),您是否已將Azure存儲包添加到您正在啓動的本機中除了pcl。 –