Closed mribeiro-clearsale closed 1 week ago
Hi, @mribeiro-clearsale. Our dependency targets the minimum supported version. I've tried to reproduce on our test project by updating that to target 2.30, and I see no compilation errors, even when the Elastic.Apm.MongoDb
targets 2.28. Can you provide a minimal repro so we can investigate further? Your app should resolve to use the latest version. Unless those breaking changes impact the diagnostic events we observe, I can't immediately see why this would result in compilation errors in your code.
Hi, Steve. Thanks for the feedback. Actually, the problem occurs because in my application I reference the dependency Elastic.Apm.NetCoreAll which has a dependency on MongoDB.Driver.Core 2.29.0 through the dependency Elastic.Apm.MongoDb. In my application, I am trying to update the dependency of MongoDB.Driver to 2.30. When I do this, an error occurs due to two different versions of the same dependency, making it impossible for me to update the driver version to 2.30.
Also, we use MongoDbEventSubscriber to trace MongoDB events, but an incompatibility error occurs with the IEventSubscriber interface from MongoDB.Driver 3.0.
@mribeiro-clearsale I don't believe our NetCoreAll
package should cause the issue. Our package depends on a minimum version of 2.28.0
, so I suspect something else is pinning your app to 2.29.0
. I cannot reproduce this in a rudimentary attempt.
Using a new .NET 8 project:
csproj
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Elastic.Apm.NetCoreAll" Version="1.30.0" />
<PackageReference Include="MongoDB.Driver" Version="2.30.0" />
</ItemGroup>
</Project>
Program.cs
using Elastic.Apm.MongoDb;
var settings = new MongoDB.Driver.MongoClientSettings
{
ClusterConfigurator = builder => builder.Subscribe(new MongoDbEventSubscriber())
};
Resolve packages:
We require a minimal repro to assist further.
@stevejgordon thanks again for your reply.
I just created the repo that reproduces the problem:
https://github.com/mribeiro-clearsale/ElasticAPMMongoDBDependency/tree/master
What I found strange is that in your print the NetCoreAll dependency is with version 1.30 of MongoDB.Driver.Core. But I just updated the NetCoreAll lib to 1.30.1 and the dependency remained at 1.28 as you can see in this repo
I managed to solve the problem and I have no clue what happens.
We were using version 2.28 and updated via Managed Nuget Packaged for Solutions. The csproj changed correctly to 2.30, but the dependencies of other packages that also depend on the driver did not change.
Even after performing a cleanup on the solution, the problem persists.
I changed the version manually in the csproj, going back to 2.28 and then back to 2.30 and it worked magically, the dependencies of all the libs were changed correctly, solving the problem.
Thank you for your attention @stevejgordon
You're welcome, @mribeiro-clearsale. I'm glad you managed to resolve it.
APM Agent version
Elastic.Apm.NetCoreAll 1.30.0
Environment
Operating system and version:
.NET 8
Describe the bug
We have been updating our MongoDB.Driver since we upgraded our MongoDB Cluster to 8.0 and we have new features that are only compatible with Driver 3.0.
This new driver version has some breaking changes: MongoDB Driver 4.0 Breaking Changes
We are having issues with Elastic APM Agent because the MongoDB.Driver used is version 2.28
The error below occurs because we have MongoDB.Driver updated to 2.30 but Elastic.APM.NetCoreAll uses 2.28
And this error occurs because one of the breaking changes to MongoDB.Driver
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Upgrade MongoDB.Driver dependency on Elastic.APM.NetCoreAll