Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to load OData adapter from assembly Simple.OData.Client.V3.Adapter

Tags:

c#

xamarin

odata

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.

like image 845
casillas Avatar asked Apr 08 '15 21:04

casillas


Video Answer


1 Answers

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");
}
like image 57
casillas Avatar answered Oct 19 '22 00:10

casillas