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

C# driver with .NET 7.0 & Linux doesn't work

    • Type: Icon: Bug Bug
    • Resolution: Gone away
    • Priority: Icon: Critical - P2 Critical - P2
    • None
    • Affects Version/s: 2.22.0
    • Component/s: None

      Summary

      I get System.MissingMethodException when trying to connect to MongoDB instance.

      Please provide the version of the driver. If applicable, please provide the MongoDB server version and topology (standalone, replica set, or sharded cluster).

      Driver version 2.22.0

      How to Reproduce

      Run following code in .NET 7 on linux-x64

      var client = new MongoClient("mongodb://my-mongodb-server:27017/");
      var databases = client.ListDatabases().ToList();

      publish using following publish profile:

      <?xml version="1.0" encoding="utf-8"?>
      <Project>
          <PropertyGroup>
              <Configuration>Release</Configuration>
              <PublishDir>bin\publish\linux-x64\</PublishDir>
              <PublishProtocol>FileSystem</PublishProtocol>
              <_TargetId>Folder</_TargetId>
              <TargetFramework>net7.0</TargetFramework>
              <RuntimeIdentifier>linux-x64</RuntimeIdentifier>
              <SelfContained>true</SelfContained>
              <PublishSingleFile>true</PublishSingleFile>
              <PublishTrimmed>true</PublishTrimmed>
          </PropertyGroup>
      </Project>

      Additional Background

      install@REDACTED:~$ uname -a
      Linux REDACTED 5.15.0-76-generic #83-Ubuntu SMP Thu Jun 15 19:16:32 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

        1. MongoSample.zip
          3 kB
        2. stacktrace.txt
          5 kB

            Assignee:
            boris.dogadov@mongodb.com Boris Dogadov
            Reporter:
            mbalous@outlook.com Martin B
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: