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

MongoDB.Driver v3 breaks Aspire.MongoDB.Driver integration #6380

Closed
eerhardt opened this issue Oct 18, 2024 · 9 comments · Fixed by #7034
Closed

MongoDB.Driver v3 breaks Aspire.MongoDB.Driver integration #6380

eerhardt opened this issue Oct 18, 2024 · 9 comments · Fixed by #7034
Assignees
Labels
area-integrations Issues pertaining to Aspire Integrations packages mongodb Issues related to mongodb integrations
Milestone

Comments

@eerhardt
Copy link
Member

https://github.com/mongodb/mongo-csharp-driver/releases/tag/v3.0.0

The MongoDB .NET/C# driver team is pleased to announce our v3.0.0 release! The 3.0.0 release incorporates many user-requested fixes and improvements that have been deferred as backwards-incompatible, as well as internal improvements to pay down technical debt and improve maintainability. Additional major changes include removal of a large area of the public API (mainly from MongoDB.Driver.Core), which was not intended for public use. Removed APIs are marked as deprecated in v2.30.0 version.
For all the breaking changes and for the upgrade guidlines, please see the upgrade guide.

We should follow the same approach as outlined in RabbitMQ.Client v7 breaks Aspire.RabbitMQ.Client component (dotnet/aspire#3956)

cc @sebastienros @radical @joperezr @DamianEdwards

@eerhardt eerhardt added area-integrations Issues pertaining to Aspire Integrations packages mongodb Issues related to mongodb integrations labels Oct 18, 2024
@eerhardt
Copy link
Member Author

Exception you get when using the 3.0.0 version of MongoDB.Driver with the Aspire integration:

System.IO.FileNotFoundException: Could not load file or assembly 'MongoDB.Driver.Core, Version=2.29.0.0, Culture=neutral, PublicKeyToken=94992a530f44e321'. The system cannot find the file specified.
File name: 'MongoDB.Driver.Core, Version=2.29.0.0, Culture=neutral, PublicKeyToken=94992a530f44e321'
   at Microsoft.Extensions.Hosting.AspireMongoDBDriverExtensions.CreateMongoClient(IServiceProvider serviceProvider, String connectionName, MongoDBSettings mongoDbSettings, Action`1 configureClientSettings)
   at Microsoft.Extensions.Hosting.AspireMongoDBDriverExtensions.<>c__DisplayClass5_0.<AddMongoClient>b__0(IServiceProvider sp) in /_/src/Components/Aspire.MongoDB.Driver/AspireMongoDBDriverExtensions.cs:line 113
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSiteMain(ServiceCallSite callSite, TArgument argument)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitRootCache(ServiceCallSite callSite, RuntimeResolverContext context)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(ServiceCallSite callSite, TArgument argument)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.Resolve(ServiceCallSite callSite, ServiceProviderEngineScope scope)
   at Microsoft.Extensions.DependencyInjection.ServiceProvider.CreateServiceAccessor(ServiceIdentifier serviceIdentifier)
   at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory)
   at Microsoft.Extensions.DependencyInjection.ServiceProvider.GetService(ServiceIdentifier serviceIdentifier, ServiceProviderEngineScope serviceProviderEngineScope)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngineScope.GetService(Type serviceType)
   at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider provider, Type serviceType)
   at lambda_method2(Closure, Object, HttpContext)
   at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddlewareImpl.Invoke(HttpContext context)

eerhardt added a commit to joperezr/aspire that referenced this issue Oct 18, 2024
eerhardt added a commit to eerhardt/aspire that referenced this issue Oct 18, 2024
Version 3.0.0 brings breaking changes that are incompatible with the Aspire integration library.

Contributes to dotnet#6380
@DamianEdwards
Copy link
Member

Is the plan to take #6381 for 9.0 GA? I'd think we should right?

@eerhardt
Copy link
Member Author

Is the plan to take #6381 for 9.0 GA? I'd think we should right?

Yes, that was my plan. So people don't use the Aspire library with the 3.0.0 version of MongoDB.Driver.

eerhardt added a commit that referenced this issue Oct 19, 2024
Version 3.0.0 brings breaking changes that are incompatible with the Aspire integration library.

Contributes to #6380
@paulomorgado
Copy link
Contributor

paulomorgado commented Oct 21, 2024

Is the plan to take #6381 for 9.0 GA? I'd think we should right?

Yes, that was my plan. So people don't use the Aspire library with the 3.0.0 version of MongoDB.Driver.

Why?

I would understand if below 3.0.0 would not be possible with Aspire 9.0, but not this. So, I need to choose between Aspire or MongoDB 3.0.0?

@JamesKovacs, MongoDB should provide a MongoDB.Driver.Core package with type forwarding to ease migration to MongoDb.Driver 3.0.0. As it is, it will break a lot of libraries and applications and delay (or prevent) the adoption of MongoDb.Driver 3.0.0. And out-of-the-box OpenTelemetry support.

@joperezr joperezr added the untriaged New issue has not been triaged label Oct 21, 2024
@joperezr joperezr added this to the Backlog milestone Oct 22, 2024
@joperezr joperezr removed the untriaged New issue has not been triaged label Oct 22, 2024
@eerhardt
Copy link
Member Author

Yes, that was my plan. So people don't use the Aspire library with the 3.0.0 version of MongoDB.Driver.

Why?

Because it doesn't work. See the above exception.

@jakoss
Copy link

jakoss commented Dec 12, 2024

Is there a plan to tackle that in the near future? Because of this aspire is locking our project to upgrade MongoDB Driver and MongoDB EF Provider in effect. Right now we are not using the aspire package for mongo, but as you can imagine - having telemetry would be great :)

@eerhardt
Copy link
Member Author

Is there a plan to tackle that in the near future? Because of this aspire is locking our project to upgrade MongoDB Driver and MongoDB EF Provider in effect. Right now we are not using the aspire package for mongo, but as you can imagine - having telemetry would be great :)

Yes, I plan on having this updated in .NET Aspire 9.1 early-ish next year. There are ripple effects I'm working on, for example: Xabaril/AspNetCore.Diagnostics.HealthChecks#2324. But expect this to be fixed in the next minor version.

@jakoss
Copy link

jakoss commented Dec 12, 2024

Awesome, thanks

@paulomorgado
Copy link
Contributor

@jakoss

I haven't tried it, but MongoDB.Driver.Core.Extensions.DiagnosticSources 2.0.0 no longer depends on MongoDB.Driver.Core.

You might be able to force MongoDB.Driver to 3.0.0 or upper and force MongoDB.Driver.Core.Extensions.DiagnosticSources to 2.0.0 and get away with it.

Try it out!

eerhardt added a commit to eerhardt/aspire that referenced this issue Jan 7, 2025
MongoDB.Driver shipped a version `3.0.0` that has binary breaking changes such that we can't build a single library that can load in both v2.x and v3.x. To continue supporting new versions of MongoDB.Driver, we need to add a new component Aspire.MongoDB.Driver.v3 that will work with the new version of MongoDB.Driver. See dotnet#3956 for the strategy to deal with these breaking changes.

Fix dotnet#6380
@joperezr joperezr modified the milestones: Backlog, 9.1 Jan 9, 2025
eerhardt added a commit to eerhardt/aspire that referenced this issue Jan 13, 2025
MongoDB.Driver shipped a version `3.0.0` that has binary breaking changes such that we can't build a single library that can load in both v2.x and v3.x. To continue supporting new versions of MongoDB.Driver, we need to add a new component Aspire.MongoDB.Driver.v3 that will work with the new version of MongoDB.Driver. See dotnet#3956 for the strategy to deal with these breaking changes.

Fix dotnet#6380
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-integrations Issues pertaining to Aspire Integrations packages mongodb Issues related to mongodb integrations
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants