Net 4.6 and Azure DocumentDb

I’m trying to get Azure DocumentDb to work with the .NET 4.6 experimental backend, and I’m getting this type load exception. Any idea what’s going on or is this even possible? Thanks!

I have my C# DLL set to .NET 4.6 and have the DocumentDb DLL references and copied over to the plugins directory. Everything seems to build fine, it’s just at runtime when I make the call to Initialize the client I get this:

TypeLoadException: Could not resolve type with token 010000f6
Microsoft.Azure.Documents.Client.DocumentClient.Initialize (System.Uri serviceEndpoint, Microsoft.Azure.Documents.Client.ConnectionPolicy connectionPolicy, System.Nullable1[T] desiredConsistencyLevel) (at <3034b756466e4e2db019736f9235e573>:0) Microsoft.Azure.Documents.Client.DocumentClient..ctor (System.Uri serviceEndpoint, System.String authKeyOrResourceToken, Microsoft.Azure.Documents.Client.ConnectionPolicy connectionPolicy, System.Nullable1[T] desiredConsistencyLevel, Newtonsoft.Json.JsonSerializerSettings serializerSettings) (at <3034b756466e4e2db019736f9235e573>:0)
Unity2017DLLTest.DocumentDBRepository`1[T].Initialize () (at <21c9750edaf1498992aa9a4ef9990825>:0)
Unity2017DLLTest.MyUtilities.InitDb () (at <21c9750edaf1498992aa9a4ef9990825>:0)
AzureDocDb.OnGUI () (at Assets/AzureDocDb.cs:27)

I’m not sure about the cause of this issue. It looks like the metadata from the assembly is not being read correctly. Can you submit a bug report with this project? We would like to investigate it here.

1 Like

Thanks, I’ve created the bug report: Case 934907

I also noticed a previous thread that had a similar issue trying to get Azure DocumentDb to work. But the temp solution they found required a patched DLL and work around that doesn’t seem great:

Thanks, we will investigate this.

1 Like

@JoshPeterson , this issue is a dupe from one that’s been around for a while without much interest in the tracker. Our team needs to decide pretty soon on our backend connection scenario from a Unity headless server, and DocumentDb is our preferred Db.

Do you have an idea when and if this issue can be looked at? We might have to go with a different approach altogether if we can’t access DocDb from Unity any time soon.

Thanks!

I would recommend looking for another solution in the near team. The new scripting runtime is still experimental in 2017.1, so you’ll need to wait for the Unity 2017.2 release (or later) to have a supported version. For any production use, I would not recommend taking a dependency on the new scripting runtime now.