Uploaded image for project: 'C# Driver'
  1. C# Driver
  2. CSHARP-2135

Issue with MongoDB.Driver.Core dll version 2.5

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Duplicate
    • Affects Version/s: 2.5
    • Fix Version/s: 2.7.0
    • Component/s: API, Connectivity
    • Labels:
    • Environment:
      Visual Studio 2015, 4.5.2 .Net framework, MongoDB 2.5 version, Windows 10

      Description

      Hello Support,

      I have trying to make MongoDB work on my system since a week now. I didnt not find any better solution to resolve the issue.Hence I am hoping the issue can be resolved here.,\

      We are trying to build a module and use the MongoDB as the directory for the module inputs. Hence we have installed the latest version of Mongo DB dlls from Nuget Package manager, we got 2.5 version of Bson, Core and Driver dlls. Along these, 4.3.0 version of Interop services have been installed.

      However when I try to make a connection via code, I get the following error.

      Could not load file or assembly 'System.Runtime.InteropServices.RuntimeInformation, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) .

      Failing at the below highlighted line.

      Code snippet:

      List<BsonDocument> oList = new List<BsonDocument>();
      try
      {
      IMongoClient client = new MongoClient("mongodb://RedirectUser:brother@ambriig1:27017/Redirect");
      IMongoDatabase database = client.GetDatabase("Redirect");
      IMongoCollection<BsonDocument> collection = database.GetCollection<BsonDocument>("Urls");
      BsonDocument Filter = new BsonDocument("OldURL", path);
      oList = collection.Find(Filter).ToList();
      return oList;
      }

      package config looks like:

      <?xml version="1.0" encoding="utf-8"?>
      <packages>
      <package id="DnsClient" version="1.0.7" targetFramework="net452" />
      <package id="mongocsharpdriver" version="2.5.0" targetFramework="net452" />
      <package id="MongoDB.Bson" version="2.5.0" targetFramework="net452" />
      <package id="MongoDB.Driver" version="2.5.0" targetFramework="net452" />
      <package id="MongoDB.Driver.Core" version="2.5.0" targetFramework="net452" />
      <package id="System.Buffers" version="4.3.0" targetFramework="net452" />
      <package id="System.Runtime.InteropServices.RuntimeInformation" version="4.3.0" targetFramework="net452" />
      </packages>

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                1 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: