Encryption Pipelines: Adds SDK-surface parity build to catch TypeLoad gaps#5798
Merged
microsoft-github-policy-service[bot] merged 5 commits intomasterfrom Apr 24, 2026
Conversation
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
… gaps The Encryption and Encryption.Custom official release pipelines previously built each project only against the pinned Microsoft.Azure.Cosmos NuGet. That does not detect abstract members added to Container on master that lack an unconditional override in EncryptionContainer - the exact class of defect fixed by PR #5783 (SemanticRerankAsync TypeLoadException). The override for the fixed method was gated '#if PREVIEW && SDKPROJECTREF', so a build that defines both symbols (the existing PR validation pattern) also masks the defect: the override is compiled back in and the missing- implementation condition never manifests. The bug only surfaces when the Encryption.Custom NuGet is built with PREVIEW on and SDKPROJECTREF off and is then loaded against an SDK that contains the new abstract member. This change: 1. Decouples the SDKPROJECTREF preprocessor define from the SdkProjectRef MSBuild property via a new DefineSdkProjectRefSymbol knob. Default behavior is unchanged: SdkProjectRef=true still sets SDKPROJECTREF. 2. Adds two build steps to each encryption official release-gate template: - SDKREF build: '-p:IsPreview=true -p:SdkProjectRef=true' - verifies the full project-reference path still compiles against master SDK source. - NuGet-surface parity build: '-p:IsPreview=true -p:SdkProjectRef=true -p:DefineSdkProjectRefSymbol=false' - links against master SDK source with the exact preprocessor surface of the shipped NuGet (PREVIEW on, SDKPROJECTREF off). Any newly-added abstract member on Container that lacks an unconditional override in EncryptionContainer now fails this step with CS0534. Verified locally by reverting PR #5783 in a worktree: the parity build for Encryption.Custom fails with CS0534 on SemanticRerankAsync, exactly catching the bug. All six build permutations (default + SDKREF + parity for both Encryption and Encryption.Custom) pass at the fixed state. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
5d167db to
ed8ee9d
Compare
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
Member
kushagraThapar
left a comment
There was a problem hiding this comment.
Shall we add a new job that handles this for the CI pipeline for every PR? Otherwise, we will still miss this when developing, right?
Contributor
Author
@kushagraThapar this should now trigger with every PR once merged |
Member
kushagraThapar
left a comment
There was a problem hiding this comment.
Shall we add a new job that handles this for the CI pipeline for every PR? Otherwise, we will still miss this when developing, right?
Adds the same NuGet-surface parity build (IsPreview=true, SdkProjectRef=true,
DefineSdkProjectRefSymbol=false) to templates/build-preview.yml, which is
invoked on every PR via azure-pipelines.yml. The existing release-gate copy
in templates/static-tools-encryption{,-custom}.yml is kept as a
belt-and-suspenders check, but only ran at release time because those
templates are consumed exclusively by azure-pipelines-encryption-{custom-,}official.yml
which use trigger: none / pr: none.
This ensures new abstract members on Container under #if PREVIEW that lack
an unconditional override in EncryptionContainer fail at PR-time with CS0534
instead of at customer runtime as TypeLoadException.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
09ea3e4 to
84832a5
Compare
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
kushagraThapar
approved these changes
Apr 24, 2026
ananth7592
approved these changes
Apr 24, 2026
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.
Problem
The Encryption and Encryption.Custom official release pipelines previously built each project only against the pinned
Microsoft.Azure.CosmosNuGet declared in the project file. That does not detect abstract members added toContaineron master that lack an unconditional override inEncryptionContainer— the exact class of defect fixed by #5783 (SemanticRerankAsyncTypeLoadException).The customer-facing symptom from #5783:
Why a naive SDKREF build is not enough
The override was gated
#if PREVIEW && SDKPROJECTREF. Any build that defines both symbols — which is what the existing PR-validation build (build-preview.yml) does, and what an obvious "build withSdkProjectRef=true" addition would also do — compiles the override back in and the missing-implementation condition never manifests:PREVIEWSDKPROJECTREF3.41.0-preview.0)-p:IsPreview=true -p:SdkProjectRef=trueDefineSdkProjectRefSymbol=false)The bug only manifests when
PREVIEWis on andSDKPROJECTREFis off, linked against an SDK that contains the new abstract member. That is the exact surface of the shipped Encryption.Custom NuGet.Change
Decouple the
SDKPROJECTREFpreprocessor define from theSdkProjectRefMSBuild property via a newDefineSdkProjectRefSymbolknob in both:Microsoft.Azure.Cosmos.Encryption.Custom/src/Microsoft.Azure.Cosmos.Encryption.Custom.csprojMicrosoft.Azure.Cosmos.Encryption/src/Microsoft.Azure.Cosmos.Encryption.csprojDefault behaviour is unchanged:
SdkProjectRef=truestill setsSDKPROJECTREF. Pipelines can now opt out with-p:DefineSdkProjectRefSymbol=false.Add two build steps to each encryption official release-gate template (
templates/static-tools-encryption.yml,templates/static-tools-encryption-custom.yml):-p:IsPreview=true -p:SdkProjectRef=true. Verifies the full project-reference path still compiles against master SDK source.-p:IsPreview=true -p:SdkProjectRef=true -p:DefineSdkProjectRefSymbol=false. Links against master SDK source with the exact preprocessor surface of the shipped NuGet. Any newly-added abstract member onContainerunder#if PREVIEWwithout an unconditional override inEncryptionContainernow fails this step withCS0534.Proof the pipeline catches #5783
I reverted #5783 in a worktree (
virtual→abstractonContainer.SemanticRerankAsync) and ran the new parity build for Encryption.Custom:That is exactly the runtime
TypeLoadExceptionsurface from the customer report, caught at compile time.All six build permutations (default / SDKREF / parity × Encryption / Encryption.Custom) pass at the fixed state:
Microsoft.Azure.Cosmos.EncryptionMicrosoft.Azure.Cosmos.Encryption.CustomType of change
Closing issues
Related to #5783.