Skip to content

[BUG] The build fails when using side-by-side with Mongo Driver 3.0 #2504

Open
@quixoticaxis

Description

@quixoticaxis

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'

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions