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

Include more detail when throwing PlatformNotSupportedException errors

    • Type: Icon: Improvement Improvement
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 2.15.1
    • Affects Version/s: None
    • Component/s: None
    • None

      When a System.PlatformNotSupportedException is raised it is not clear which library failed to load.

      For example in the following test case it's not clear the failure is due to the zstd compressor failing when targeting Any CPU vs. x64:

      Unable to find source-code formatter for language: csharp. Available languages are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, perl, php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, yaml
      [TestMethod]
      public void TestMethodFails()
      {
          MongoClient client = new MongoClient("mongodb://localhost:27017/?compressors=zstd,zlib,snappy");
          IMongoDatabase db = client.GetDatabase("test");
          IMongoCollection<BsonDocument> collection = db.GetCollection<BsonDocument>("foo");
          FilterDefinition<BsonDocument> filter = Builders<BsonDocument>.Filter.Empty;
          BsonDocument first = collection.Find(filter).FirstOrDefault();
      }
      

            Assignee:
            boris.dogadov@mongodb.com Boris Dogadov
            Reporter:
            alex.bevilacqua@mongodb.com Alex Bevilacqua
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: