[Client encryption]: Fixes failing contract tests on .NET 8#5373
Closed
adamnova wants to merge 31 commits intoAzure:masterfrom
Closed
[Client encryption]: Fixes failing contract tests on .NET 8#5373adamnova wants to merge 31 commits intoAzure:masterfrom
adamnova wants to merge 31 commits intoAzure:masterfrom
Conversation
Introduces .NET 8-specific contract baseline files for Cosmos Encryption and updates contract enforcement tests to select the correct baseline per target framework. Also updates contract JSONs and the UpdateContracts.ps1 script to support these changes.
Eliminated the candidate file name using the full TFM in ContractEnforcementTests for both Encryption and Encryption.Custom test projects, simplifying the candidate list to only use the major TFM version and the default file name.
Contributor
|
\azp run |
kirankumarkolli
previously approved these changes
Oct 7, 2025
Member
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
NaluTripician
previously approved these changes
Oct 7, 2025
Updated contract enforcement logic to use '.net{majorVersion}' file naming. Added new region fields and AvailabilityStrategy property to DotNetPreviewSDKAPI contract. Enhanced baseline XMLs with additional activity and event data, and improved formatting in query plan and trace writer baselines.
Changed the file include pattern in the test project to match all DotNetSDKEncryptionCustomAPI*.json files, ensuring all relevant contract files are copied to the output directory.
Member
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Member
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Member
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Contributor
|
/azp run |
|
Commenter does not have sufficient privileges for PR 5373 in repo Azure/azure-cosmos-dotnet-v3 |
Deleted several obsolete region fields and the AvailabilityStrategy property/methods from DotNetSDKAPI.json to reflect recent API changes and cleanup unused contract members.
Contributor
Author
|
/azp run |
|
Commenter does not have sufficient privileges for PR 5373 in repo Azure/azure-cosmos-dotnet-v3 |
… frameworks - Enhanced GetAssemblyLocally() to detect and prefer assemblies matching the test's target framework - Added IsCompatibleFramework() helper to handle .NETStandard/.NETCoreApp compatibility - Prevents non-deterministic behavior when multiple TFMs (net6.0, net8.0) are loaded - Resolves flakiness where FirstOrDefault() could pick wrong assembly version Addresses issue where contract tests would fail inconsistently depending on which assembly version was arbitrarily selected from AppDomain.
…ts.ps1 - Added explicit '-f net6.0' flag to all dotnet test commands - Ensures consistent framework selection regardless of environment defaults - Prevents implicit TFM selection which varies by SDK version and project configuration - Complements existing net8.0 commands which already use '-f net8.0' This eliminates environment-dependent behavior where the default TFM could be net6.0 or net8.0 depending on SDK installation or project TargetFrameworks order.
- Added baseline file existence check before running contract validation - Provides clear error message indicating which TFM baseline is missing - Added comprehensive XML documentation explaining multi-target contract pattern - Directs developers to run UpdateContracts.ps1 when baselines are missing Prevents cryptic 'contract changed' errors when the actual issue is a missing baseline file for the current target framework (net6.0 or net8.0). Improves developer experience by providing actionable error messages instead of confusing diffs between current API and non-existent baseline.
adamnova
commented
Oct 9, 2025
| } | ||
| }, | ||
| "Members": { | ||
| "Microsoft.Azure.Cosmos.AvailabilityStrategy AvailabilityStrategy": { |
Reorders the arguments in Newtonsoft.Json.JsonPropertyAttribute from (NullValueHandling, PropertyName) to (PropertyName, NullValueHandling) for consistency and clarity in DotNetSDKEncryptionCustomAPI.json test contract.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request Template
#4678
Description
The contracts test is failing due to incorrectly used templates and the contracts being different between .net 6 and .net 8