我有以下代码,我希望Simple.oData.Client
从Northwind
服务中获取oData().一旦用户点击Click按钮,它就会触发oData Call.它before await
在控制台上打印出消息;但是,它不打印after await
消息.这意味着在try-catch
块中的等待操作中有一些不正常的事情.我想知道如何处理这个问题.我正在使用Xamarin.iOS平台.
async partial void Click_TouchUpInside (UIButton sender)
{
var client= new ODataClient("http://services.odata.org/Northwind/Northwind.svc/");
Console.WriteLine("before await");
try {
var packages = await client
.For("Customers").
FindEntriesAsync();
}
catch(AggregateException e) {
Console.WriteLine(e);
Console.WriteLine(e.InnerException);
}
Console.WriteLine("after await");
}
Run Code Online (Sandbox Code Playgroud)
这是详细错误消息:
System.AggregateException:发生一个或多个错误---> System.AggregateException:发生一个或多个错误---> System.InvalidOperationException:无法从程序集Simple.OData.Client.V3.Adapter --->加载OData适配器System.IO.FileNotFoundException:无法加载文件或程序集"Simple.OData.Client.V3.Adapter"或其依赖项之一.该系统找不到指定的文件.
谁需要知道如何解决这个问题,这里是Simple.OData.Client
github 的源代码所有者的详细解释.
https://github.com/object/Simple.OData.Client/issues/53
我Simple.OData.Client.V3Adapter.Reference()
在我的代码中添加了一行代码Main.cs
,它就像一个魅力.
static void Main (string[] args)
{
Simple.OData.Client.V3Adapter.Reference();
UIApplication.Main (args, null, "AppDelegate");
}
Run Code Online (Sandbox Code Playgroud)