Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Outdated MongoDB.Driver.Core dependency in Elastic.Apm.MongoDb #2416

Closed
th3ragex opened this issue Aug 14, 2024 · 6 comments · Fixed by #2419
Closed

[BUG] Outdated MongoDB.Driver.Core dependency in Elastic.Apm.MongoDb #2416

th3ragex opened this issue Aug 14, 2024 · 6 comments · Fixed by #2419
Labels
bug Something isn't working community triage

Comments

@th3ragex
Copy link

The lastest MongoDB Diagnostic listener has a dependency to "MongoDB.Driver.Core" Version="2.19.0"

<PackageReference Include="MongoDB.Driver.Core" Version="2.19.0" />

I have compile issues in a project with a dependency to MongoDB.Driver Version 2.28.0 with "MongoDB.Driver.Core" Version="2.28.0" as transient dependency and "Elastic.Apm.MongoDb" Version="1.28.1".

error CS0012: The type 'IEventSubscriber' is defined in an assembly that is not referenced. You must add a reference to assembly 'MongoDB.Driver.Core, Version=2.19.0.0, Culture=neutral, PublicKeyToken=null'.
error CS1503: Argument 1: cannot convert from 'Elastic.Apm.MongoDb.MongoDbEventSubscriber' to 'MongoDB.Driver.Core.Events.IEventSubscriber'

in:

var clientSettings = MongoClientSettings.FromConnectionString(settings.ConnectionString);

// https://www.elastic.co/guide/en/apm/agent/dotnet/1.x/setup-mongo-db.html
clientSettings.ClusterConfigurator = builder => builder.Subscribe(new MongoDbEventSubscriber());

The last update was done on year ago: #2030

  1. Did the dependabot / renovatebot break?
  2. Please update the MongoDB.Driver.Core dependency.
@th3ragex th3ragex added the bug Something isn't working label Aug 14, 2024
@Mpdreamz
Copy link
Member

I'm all for updating deps in general,

Need to dive in and understand what the breaking change between 2.19.0 and 2.28.0 is though.

@Mpdreamz
Copy link
Member

Oh yeah thanks for bringing this to our attention @th3ragex! 😸

@aciobaniteia
Copy link

aciobaniteia commented Aug 15, 2024

Hi @Mpdreamz

We are facing the same issue and another one:
CS0012 The type 'IMongoClient' is defined in an assembly that is not referenced. You must add a reference to assembly 'MongoDB.Driver, Version=2.22.0.0, Culture=neutral, PublicKeyToken=null'

    services.AddMongoDb(
        MongoClientSettings.FromUrl(mongoUrl),
        name: "MongoDBHealthCheck",
        timeout: options.HealthcheckTimeout);

The behaviour is very weird. When we were having the version to 2.22.0 all was working fine, but when we are trying to update to 2.28.0 we get the same error as @th3ragex with the one mentioned

@Mpdreamz
Copy link
Member

Looks like MongoDB 1.28.0 introduced a breaking change:

https://www.mongodb.com/docs/drivers/csharp/current/upgrade/#std-label-csharp-breaking-changes-2.28.0

@Mpdreamz
Copy link
Member

Opened #2419 to address this

@Mpdreamz Mpdreamz linked a pull request Aug 15, 2024 that will close this issue
@callumgoodridge2
Copy link

There's a similar issue occurring now when updating the MongoDB.Driver package to v3.0.0. Looks like Elastic.Apm.MongoDb will require this update from v2.28.0 to v3.0.0

Opened #2419 to address this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working community triage
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants