I have the following code which I expect to get oData (Simple.oData.Client
) from Northwind
service. Once user clicks on the Click button, then it triggers the oData Call. It prints out before await
message on the console;however, it does not print after await
message. It means there is something not going right in await operation in the try-catch
block. I would like to know how to handle that problem.
I am using Xamarin.iOS platform.
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");
}
Here is the detail error message:
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.
To whom need to know how this issue has been resolved, here is the detail explanation from the source code owner of the Simple.OData.Client
github.
https://github.com/object/Simple.OData.Client/issues/53
I have added a single line of code Simple.OData.Client.V3Adapter.Reference()
in my Main.cs
, and it works like a charm.
static void Main (string[] args)
{
Simple.OData.Client.V3Adapter.Reference();
UIApplication.Main (args, null, "AppDelegate");
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With