errors using Remotion LINQ with BrightStarDB

May 1, 2015 at 4:26 AM
I'm using BrightStarDB (version 1.10.0.0) for the first time - and I was able to install it and use it within my test ASP.NET MVC 5.2 app get data loaded into the data store. However, when I try to use LINQ to retrieve the data, I get a series of errors.

If I use the version of Remotion.Linq.dll indicated by BrightStar (1.3.122.1), the solution compiles but I get the following error when I run it:

Could not load file or assembly 'Remotion.Linq' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

If I load the latest version of Remotion.Linq.dll from nuget (1.15.15.0), the solution compiles and runs, but I get the following error when I try to retrieve the loaded data from the collection using a LINQ Where method:

An exception of type 'System.MissingMethodException' occurred in BrightstarDB.dll but was not handled in user code

Additional information: Method not found: 'Remotion.Linq.Collections.ObservableCollection`1<Remotion.Linq.Clauses.IBodyClause> Remotion.Linq.QueryModel.get_BodyClauses()'.

I also get errors when I use the LINQ ToList or To Array methods on the same collection.

Is there anything I'm doing wrong (and if so what) or is there a bug? Please let me know. Thanks in advance for your help!
Coordinator
May 1, 2015 at 10:38 AM
Hi,

You will need to use the Remotion.Linq DLL that ships with BrightstarDB - I originally needed to make some tweaks to the internals of Remotion.Linq so we ship a compiled version of that code. It sounds like maybe you are trying to use the DLL shipped by the Remotion project, and I'm pretty sure that currently that won't work.

It would actually be a good thing for us to get around to fixing things so that we can use the Remotion.Linq NuGet package instead, but it will depend on whether the more recent version fixes stuff that didn't work before and whether they have PCL support for the frameworks we support. From the error you have with their latest version it sounds like possibly there are some API incompatibilities to work around too :-(

Anyway, short story is: Use the Remotion.Linq.dll that is in the BrightstarDB SDK directory and hopefully that should fix your issues.

Cheers

Kal
May 1, 2015 at 1:31 PM
I tried two different instances of Remotion.Linq DLL version 1.3.122.1 included as a reference in my project. One was a file I found and downloaded from the web. The other was the one that ships with BrightStarDB (in the folder C:\Program Files\BrightstarDB\SDK\NET40). Both assemblies produced the same result ("Could not load file or assembly 'Remotion.Linq' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)" when I run my app. So I had the same thought - and it didn't work.

Thanks for the suggestion though - any other ideas?
Coordinator
May 2, 2015 at 7:46 PM
Hmm... not sure what is happening there. Sometimes VS can get a bit confused about the assembly references so it might be worth opening the .csproj file in a text editor to make sure that the assembly references have a HintPath that is pointing to the right version. Alternatively it might just be easier to create the project again from scratch and then copy over the source files.

Also make sure that the CopyLocal property on the assemblies are set to True as you will want all of the assemblies that are in the SDK\NET40 folder to be copied with your app assembly.

It might also be worth checking the target framework of your project. Note that the .NET Framework 4 Client Profile is not supported. You will need to use the .NET Framework 4 (or later).

Hope one of these suggestions helps!