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] The build fails when using side-by-side with Mongo Driver 3.0 #2504

Open
quixoticaxis opened this issue Nov 28, 2024 · 1 comment
Open
Labels
bug Something isn't working community triage

Comments

@quixoticaxis
Copy link

quixoticaxis commented Nov 28, 2024

APM Agent version

1.30.1

Environment

Does not matter.

.NET Framework/Core name and version :
9.0.100

Application Target Framework(s) :
net9

Describe the bug

After adding Elastic.Apm.NetCoreAll package to a new service, the service fails to compile.

To Reproduce

Add the package MongoDB.Driver, which, at the time of writing, has a version 3.0.0.
Add the package Elastic.Apm.NetCoreAll, which, at the time of writing, has a version 1.30.1.
Use any Mongo abstraction, for example, ReadConcern in your project.
Build the project.

Expected behavior

The build completes.

Actual behavior

/***/***.cs(30,30): error CS0433: The type 'ReadPreference' exists in both 'MongoDB.Driver.Core, Version=2.28.0.0, Culture=neutral, PublicKeyToken=94992a530f44e321' and 'MongoDB.Driver, Version=3.0.0.0, Culture=neutral, PublicKeyToken=94992a530f44e321'

/***/***.cs(31,27): error CS0433: The type 'ReadConcern' exists in both 'MongoDB.Driver.Core, Version=2.28.0.0, Culture=neutral, PublicKeyToken=94992a530f44e321' and 'MongoDB.Driver, Version=3.0.0.0, Culture=neutral, PublicKeyToken=94992a530f44e321'

/***/***.cs(32,28): error CS0433: The type 'WriteConcern' exists in both 'MongoDB.Driver.Core, Version=2.28.0.0, Culture=neutral, PublicKeyToken=94992a530f44e321' and 'MongoDB.Driver, Version=3.0.0.0, Culture=neutral, PublicKeyToken=94992a530f44e321'

/***/***.cs(40,38): error CS0433: The type 'ReadConcern' exists in both 'MongoDB.Driver.Core, Version=2.28.0.0, Culture=neutral, PublicKeyToken=94992a530f44e321' and 'MongoDB.Driver, Version=3.0.0.0, Culture=neutral, PublicKeyToken=94992a530f44e321'

/***/***.cs(41,41): error CS0433: The type 'ReadPreference' exists in both 'MongoDB.Driver.Core, Version=2.28.0.0, Culture=neutral, PublicKeyToken=94992a530f44e321' and 'MongoDB.Driver, Version=3.0.0.0, Culture=neutral, PublicKeyToken=94992a530f44e321'

/***/***.cs(42,39): error CS0433: The type 'WriteConcern' exists in both 'MongoDB.Driver.Core, Version=2.28.0.0, Culture=neutral, PublicKeyToken=94992a530f44e321' and 'MongoDB.Driver, Version=3.0.0.0, Culture=neutral, PublicKeyToken=94992a530f44e321'

/***/***.cs(48,16): warning CS8619: Nullability of reference types in value of type '?' doesn't match target type 'IClientSessionHandle'.

/***/***.cs(223,16): error CS0433: The type 'MongoException' exists in both 'MongoDB.Driver.Core, Version=2.28.0.0, Culture=neutral, PublicKeyToken=94992a530f44e321' and 'MongoDB.Driver, Version=3.0.0.0, Culture=neutral, PublicKeyToken=94992a530f44e321'

/***/***.cs(228,62): error CS0433: The type 'ServerErrorCategory' exists in both 'MongoDB.Driver.Core, Version=2.28.0.0, Culture=neutral, PublicKeyToken=94992a530f44e321' and 'MongoDB.Driver, Version=3.0.0.0, Culture=neutral, PublicKeyToken=94992a530f44e321'
@quixoticaxis quixoticaxis added the bug Something isn't working label Nov 28, 2024
@quixoticaxis quixoticaxis changed the title [BUG] Mongo driver is outdated [BUG] The build fails when using side-by-side with Mongo Driver 3.0 Nov 28, 2024
@quixoticaxis
Copy link
Author

quixoticaxis commented Nov 28, 2024

Downgrading the service to use Mongo.Driver 2.30.0 is a valid workaround.

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

No branches or pull requests

1 participant