无法从程序集 Simple.OData.Client.V3.Adapter 加载 OData 适配器
Unable to load OData adapter from assembly Simple.OData.Client.V3.Adapter
我有以下代码,希望从 Northwind
服务获取 oData (Simple.oData.Client
)。一旦用户点击 Click 按钮,就会触发 oData 调用。它在控制台上打印出 before await
消息;但是,它不打印 after await
消息。这意味着 try-catch
块中的 await 操作有问题。我想知道如何处理这个问题。
我正在使用 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");
}
这里是详细的错误信息:
System.AggregateException: One or more errors occurred --->
System.AggregateException: One or more errors occurred --->
System.InvalidOperationException: Unable to load OData adapter from
assembly Simple.OData.Client.V3.Adapter --->
System.IO.FileNotFoundException: Could not load file or assembly
'Simple.OData.Client.V3.Adapter' or one of its dependencies. The
system cannot find the file specified.
谁需要知道这个问题是如何解决的,这里是 Simple.OData.Client
github.
的源代码所有者的详细解释
https://github.com/object/Simple.OData.Client/issues/53
我在 Main.cs
中添加了一行代码 Simple.OData.Client.V3Adapter.Reference()
,效果非常好。
static void Main (string[] args)
{
Simple.OData.Client.V3Adapter.Reference();
UIApplication.Main (args, null, "AppDelegate");
}
我有以下代码,希望从 Northwind
服务获取 oData (Simple.oData.Client
)。一旦用户点击 Click 按钮,就会触发 oData 调用。它在控制台上打印出 before await
消息;但是,它不打印 after await
消息。这意味着 try-catch
块中的 await 操作有问题。我想知道如何处理这个问题。
我正在使用 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");
}
这里是详细的错误信息:
System.AggregateException: One or more errors occurred ---> System.AggregateException: One or more errors occurred ---> System.InvalidOperationException: Unable to load OData adapter from assembly Simple.OData.Client.V3.Adapter ---> System.IO.FileNotFoundException: Could not load file or assembly 'Simple.OData.Client.V3.Adapter' or one of its dependencies. The system cannot find the file specified.
谁需要知道这个问题是如何解决的,这里是 Simple.OData.Client
github.
https://github.com/object/Simple.OData.Client/issues/53
我在 Main.cs
中添加了一行代码 Simple.OData.Client.V3Adapter.Reference()
,效果非常好。
static void Main (string[] args)
{
Simple.OData.Client.V3Adapter.Reference();
UIApplication.Main (args, null, "AppDelegate");
}