Azure DocumentClient initialization throws System.TypeLoad Exception

Viewed 450

Update (Latest): Issue resolved. There's nothing wrong with my code. The error is thrown by System.Mono. I was able to run my app after moving my project to a windows machine.

Note: MS.Azure.DocumentDB (v1.14) is built on top of NewtonJson 6.0.0.0. Although it says in Nuget that NewtonJson version >= 6.0.8 would work, I had the latest v10.0.0.0 and it threw an exception. So make sure you build with NewtonJson 6.

Update:

I downloaded the sample right from Azure portal under quick start. I get the exact same error as the one from my own project. I think something is wrong with VS for Mac (mono framework). Exact error message: My exact exception BTW, about the image, I really have a hard time adding the image. The image popup keeps giving me an error after I drag or select a pic to upload. I have no choice but to put up the link.

I am using a Visual Studio on Mac trying to connect to my Azure DocumentDB on the cloud (Not emulator). I really have no idea why I keep getting this error. I've checked the System.Core and it was using the 4.0.0.0 version, and also tried deleting the core and added it back in. I also tried deleting the MS.Azure.DocumentDB client and added it back in. I am now suspecting that the DocumentDB API is built with a different version of System.Core. Can someone please help me with this?

        try
        {
            _client = new DocumentClient(new Uri(ConfigurationManager.AppSettings["endpoint"])
                                     , ConfigurationManager.AppSettings["authKey"]);

            CreateDatabaseIfNotExistsAsync().Wait();
            CreateCollectionIfNotExistsAsync().Wait();
        }
        catch(DocumentClientException de)
        {
            Exception baseException = de.GetBaseException();
        }
        catch(Exception e)
        {
            //Exception baseException = e.GetBaseException(); 
            string message = e.Message;
        }

Below is the exception

"Could not resolve type with token 010000f6 (from typeref, class/assembly System.Diagnostics.Eventing.EventProviderTraceListener, System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089)"

Trace Type: "System.Diagnostics.Eventing.EventProviderTraceListener"

0 Answers
Related