-
Notifications
You must be signed in to change notification settings - Fork 1.3k
CSHARP-5782: Add .NET10 to unittests and smoke tests #1827
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds .NET 10.0 support to unit tests and smoke tests in the MongoDB C# driver, aligning with the release of .NET 10. The changes include updating target frameworks, migrating from deprecated X509Certificate2 constructors to the modern X509CertificateLoader API, suppressing obsolescence warnings, and extending CI/CD configurations.
- Adds .NET 10.0 as a target framework for test projects alongside existing targets (netcoreapp3.1, net472, net5.0, net6.0, net8.0)
- Migrates X509Certificate2 loading to use X509CertificateLoader methods to avoid deprecated constructors
- Adds appropriate pragma warning suppressions for obsolete APIs (CA2022, SYSLIB0050)
Reviewed changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tests/SmokeTests/MongoDB.Driver.SmokeTests.Sdk/MongoDB.Driver.SmokeTests.Sdk.csproj | Adds net10.0 target framework and Microsoft.Extensions.* 10.0.0 package references; removes OSX-specific condition for net8.0 |
| tests/BuildProps/Tests.Build.props | Adds net10.0 to default target frameworks for test projects |
| tests/MongoDB.Driver.Examples/MongoDB.Driver.Examples.csproj | Includes net10.0 in conditional package reference for AWS Lambda dependencies |
| tests/MongoDB.Driver.TestHelpers/X509CertificateLoader.cs | Introduces helper class providing backward compatibility for X509Certificate2 loading across .NET versions |
| tests/MongoDB.Driver.Tests/X509Tests.cs | Migrates from deprecated X509Certificate2 constructor to X509CertificateLoader.LoadPkcs12FromFile |
| tests/MongoDB.Driver.Tests/SslSettingsTests.cs | Updates certificate loading to use X509CertificateLoader; adopts collection expressions |
| tests/MongoDB.Driver.Tests/AuthenticationTests.cs | Migrates X509Certificate2 instantiation to use X509CertificateLoader helper |
| tests/MongoDB.Driver.Tests/Specifications/client-side-encryption/EncryptionTestHelper.cs | Simplifies certificate loading logic using X509CertificateLoader and collection expressions |
| tests/MongoDB.Driver.Tests/Core/Configuration/SslStreamSettingsTests.cs | Replaces empty byte array certificates with embedded test certificate data; migrates to X509CertificateLoader |
| tests/MongoDB.Driver.TestHelpers/Core/CoreTestConfiguration.cs | Updates certificate loading to use X509CertificateLoader methods |
| tests/MongoDB.Driver.Tests/GridFS/GridFSSeekableDownloadStreamTests.cs | Adds CA2022 warning suppression for intentional use of deprecated Stream.Read overload in tests |
| tests/MongoDB.Bson.Tests/IO/ByteBufferStreamTests.cs | Adds CA2022 warning suppression for test code validating deprecated Stream.Read behavior |
| tests/MongoDB.Bson.Tests/IO/BsonStreamAdapterTests.cs | Adds CA2022 warning suppression for testing deprecated Stream.Read method |
| tests/MongoDB.Bson.Tests/Serialization/BsonMemberMapTests.cs | Adds SYSLIB0050 warning suppression for intentional use of FormatterServices.GetUninitializedObject in test utilities |
| tests/MongoDB.Bson.Tests/Serialization/BsonClassMapTests.cs | Adds SYSLIB0050 warning suppression for test code using FormatterServices.GetUninitializedObject |
| evergreen/evergreen.yml | Adds unit-tests-net100 and test-smoke-tests-net100 tasks for all supported platforms |
| evergreen/install-dotnet.sh | Updates default SDK version to 10.0 and adds net10.0 runtime version mapping |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| var count = 2; | ||
| subject.Dispose(); | ||
|
|
||
| #pragma warning disable CA2022 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we create a Jira ticket to review all suppressed warnings and see if we can resolve them? Or if we are OK with this, should we suppress the warning in project file instead for tests?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point, will look into this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Refactored, no need to disable the warning. Thanks for bringing this up.
|
|
||
| private BsonClassMap Clone(BsonClassMap classMap) | ||
| { | ||
| #pragma warning disable SYSLIB0050 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we have a ticket to look into the warning?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, thanks: CSHARP-5794
sanych-sun
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
sanych-sun
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
No description provided.