微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

android – Microsoft OData客户端Xamarin无法正常工作

有谁知道Microsoft OData客户端是否以及如何在Xamarin Droid上运行?

它是NuGet包’Microsoft.OData.Client’.

它在Console应用程序上运行良好,即使汇编程序包仅包含在PCL项目中也是如此.

我一直在尝试通过OData v4代码生成器.

在Xamarin上运行时,这就是我得到的:

System.AggregateException: One or more errors occured

08-28 17:12:35.621 I/MonoDroid(29197): UNHANDLED EXCEPTION: System.AggregateException: One or more errors occured ---> Microsoft.OData.Client.DataServiceQueryException: An error occurred while processing this request. ---> system.invalidOperationException: An error occurred while processing this request. ---> system.invalidCastException: Cannot cast from source type to destination type.
08-28 17:12:35.621 I/MonoDroid(29197):   at Microsoft.OData.Client.QueryResult.AsyncEndRead (System.Threading.Tasks.Task task,System.Object asyncState) [0x00000] in <filename unkNown>:0 
08-28 17:12:35.621 I/MonoDroid(29197):   --- End of inner exception stack trace ---
08-28 17:12:35.621 I/MonoDroid(29197):   at Microsoft.OData.Client.BaseAsyncResult.EndExecute[QueryResult] (System.Object source,System.String method,IAsyncResult asyncResult) [0x00000] in <filename unkNown>:0 
08-28 17:12:35.621 I/MonoDroid(29197):   at Microsoft.OData.Client.QueryResult.EndExecuteQuery[Nitzrech] (System.Object source,IAsyncResult asyncResult) [0x00000] in <filename unkNown>:0 
08-28 17:12:35.621 I/MonoDroid(29197):   --- End of inner exception stack trace ---
08-28 17:12:35.621 I/MonoDroid(29197):   at Microsoft.OData.Client.QueryResult.EndExecuteQuery[Nitzrech] (System.Object source,IAsyncResult asyncResult) [0x00000] in <filename unkNown>:0 
08-28 17:12:35.621 I/MonoDroid(29197):   at Microsoft.OData.Client.DataServiceRequest.EndExecute[Nitzrech] (System.Object source,Microsoft.OData.Client.DataServiceContext context,IAsyncResult asyncResult) [0x00000] in <filename unkNown>:0 
08-28 17:12:35.621 I/MonoDroid(29197):   --- End of inner exception stack trace ---
08-28 17:12:35.621 I/MonoDroid(29197): at System.Threading.Tasks.Task.Wait (int,System.Threading.CancellationToken) <IL 0x0004a,0x0025c>
08-28 17:12:35.621 I/MonoDroid(29197): at System.Threading.Tasks.Task.Wait () <IL 0x00007,0x00077>
08-28 17:12:35.621 I/MonoDroid(29197): at System.Threading.Tasks.Task`1<System.Collections.Generic.IEnumerable`1<Client.ODataClient.Nitzrech>>.get_Result () <0x0007b>
08-28 17:12:35.621 I/MonoDroid(29197): at Client.DataAccess.NewRepository.GetServerTable<Client.ODataClient.Nitzrech> () <0x00167>
08-28 17:12:35.621 I/MonoDroid(29197): at Client.Droid.MainActivity.OnCreate (Android.OS.Bundle) [0x00032] in c:\Users\Avrohom\Documents\Visual Studio 2013\Projects\OData\Client\Client\Client.Droid\MainActivity.cs:33
08-28 17:12:35.621 I/MonoDroid(29197): at Android.App.Activity.n_OnCreate_Landroid_os_Bundle_ (intptr,intptr,intptr) [0x00011] in /Users/builder/data/lanes/monodroid-mlion-monodroid-4.14-series/a5d57087/source/monodroid/src/Mono.Android/platforms/android-19/src/generated/Android.App.Activity.cs:2179
08-28 17:12:35.621 I/MonoDroid(29197): at (wrapper dynamic-method) object.aebd8c0d-1bcc-4b67-a482-f6f129f09cca (intptr,intptr) <IL 0x00017,0x00043>
08-28 17:12:35.621 I/MonoDroid(29197): 
08-28 17:12:35.621 I/MonoDroid(29197):  --> (Inner exception 0) Microsoft.OData.Client.DataServiceQueryException: An error occurred while processing this request. ---> system.invalidOperationException: An error occurred while processing this request. ---> system.invalidCastException: Cannot cast from source type to destination type.
08-28 17:12:35.621 I/MonoDroid(29197):   at Microsoft.OData.Client.QueryResult.AsyncEndRead (System.Threading.Tasks.Task task,IAsyncResult asyncResult) [0x00000] in <filename unkNown>:0 
An unhandled exception occured.

08-28 17:12:36.661 E/mono    (29197): 
08-28 17:12:36.661 E/mono    (29197): Unhandled Exception:
08-28 17:12:36.661 E/mono    (29197): System.AggregateException: One or more errors occured ---> Microsoft.OData.Client.DataServiceQueryException: An error occurred while processing this request. ---> system.invalidOperationException: An error occurred while processing this request. ---> system.invalidCastException: Cannot cast from source type to destination type.
08-28 17:12:36.661 E/mono    (29197):   at Microsoft.OData.Client.QueryResult.AsyncEndRead (System.Threading.Tasks.Task task,System.Object asyncState) [0x00000] in <filename unkNown>:0 
08-28 17:12:36.661 E/mono    (29197):   --- End of inner exception stack trace ---
08-28 17:12:36.661 E/mono    (29197):   at Microsoft.OData.Client.BaseAsyncResult.EndExecute[QueryResult] (System.Object source,IAsyncResult asyncResult) [0x00000] in <filename unkNown>:0 
08-28 17:12:36.661 E/mono    (29197):   at Microsoft.OData.Client.QueryResult.EndExecuteQuery[Nitzrech] (System.Object source,IAsyncResult asyncResult) [0x00000] in <filename unkNown>:0 
08-28 17:12:36.661 E/mono    (29197):   --- End of inner exception stack trace ---
08-28 17:12:36.661 E/mono    (29197):   at Microsoft.OData.Client.QueryResult.EndExecuteQuery[Nitzrech] (System.Object sourc
08-28 17:12:36.671 E/mono-rt (29197): [ERROR] FATAL UNHANDLED EXCEPTION: System.AggregateException: One or more errors occured ---> Microsoft.OData.Client.DataServiceQueryException: An error occurred while processing this request. ---> system.invalidOperationException: An error occurred while processing this request. ---> system.invalidCastException: Cannot cast from source type to destination type.
08-28 17:12:36.671 E/mono-rt (29197):   at Microsoft.OData.Client.QueryResult.AsyncEndRead (System.Threading.Tasks.Task task,System.Object asyncState) [0x00000] in <filename unkNown>:0 
08-28 17:12:36.671 E/mono-rt (29197):   --- End of inner exception stack trace ---
08-28 17:12:36.671 E/mono-rt (29197):   at Microsoft.OData.Client.BaseAsyncResult.EndExecute[QueryResult] (System.Object source,IAsyncResult asyncResult) [0x00000] in <filename unkNown>:0 
08-28 17:12:36.671 E/mono-rt (29197):   at Microsoft.OData.Client.QueryResult.EndExecuteQuery[Nitzrech] (System.Object source,IAsyncResult asyncResult) [0x00000] in <filename unkNown>:0 
08-28 17:12:36.671 E/mono-rt (29197):   --- End of inner exception stack trace ---
08-28 17:12:36.671 E/mono-rt (29197):   at Microsoft.OData.Client.QueryResult.EndExecuteQuery[Nitzrech] (System
In mgmain JNI_OnLoad
The program 'Mono' has exited with code 0 (0x0).

有人在那里提出建议吗?

问候,

Avrohom

解决方法

我不相信这个软件包支持Xamarin – 从 nuget page开始:

Targets .NET Core 5,and .NET Portable Lib with support for .NET 4.0,SL 5.0,Win Phone 8,Win Phone 8.1,and Win 8.

我建议向库的开发者提出一个问题,以获取更多相关信息,因为如果它支持Xamarin,它可能是一个错误

https://github.com/OData/odata.net/issues

组件商店中有以下组件应该可以使用,但它已经有一段时间了,因为它已经更新:

https://components.xamarin.com/view/simple.odata.client

原文地址:https://www.jb51.cc/android/315021.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐