You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Unify remaining sync/async pairs in the Always Encrypted command path #5113
Internal sync/async pairs should share one implementation: no Async suffix, return ValueTask, take bool isAsync and then the CancellationToken, and branch only at the I/O
call. Most of the key-store path follows this rule now. These pairs in the command path don't
yet:
Merge PrepareForTransparentEncryption and PrepareForTransparentEncryptionAsync
(SqlCommand.Encryption.cs) into one ValueTask method. Remove the "null task means sync"
signal in RunExecuteReaderTdsWithTransparentParameterEncryption (see its @TODO).
Align CompleteCachedQueryMetadataAsync and CompleteParameterEncryptionAsync with the
same rule.
Merge EnclaveDelegate.CreateEnclaveSession and CreateEnclaveSessionAsync, so SqlCommand.CreateEnclaveSession passes isAsync through instead of branching.
Pick the cancellation token once at the entry point. Today callers repeat isAsync ? cancellationToken : CancellationToken.None.
Fix the two PrepareForTransparentEncryptionCore overloads. The summary
("bypassing the query metadata cache") is on the wrong overload.
Constraints: keep the worker hand-off before blocking TDS writes, re-check the connection after
every await, keep key loads sequential, and keep the bounded retry. No public API change.
This is an internal refactor following the five-layer split of the async-friendly Always Encrypted work (#3672). It unifies the remaining sync/async method pairs in the command path (SqlCommand.Encryption.cs, EnclaveDelegate) into single ValueTask implementations that take bool isAsync and branch only at the I/O call. There is no public API change. Severity is P3: the work is maintainability-focused, but it touches sensitive ordering and connection-state constraints.
Next Steps
Assign this issue to Copilot coding agent or a maintainer to implement the checklist. Suggested starting points are PrepareForTransparentEncryption/Async, CompleteCachedQueryMetadataAsync, CompleteParameterEncryptionAsync, EnclaveDelegate.CreateEnclaveSession/Async, and the @TODO in RunExecuteReaderTdsWithTransparentParameterEncryption.
Preserve the stated constraints: worker hand-off before blocking TDS writes, connection re-check after every await, sequential key loads, and the bounded retry.
Add or update unit and manual tests covering both sync and async paths.
Note: This triage summary is auto-generated by an AI agent. The analysis and suggestions above have not been verified by a human maintainer. Please treat as preliminary guidance only.
Activity
github-actions commentedon Nov 18, 2026
🔍 Triage Summary
Area\Async(also relevant: Always Encrypted command path)Analysis
This is an internal refactor following the five-layer split of the async-friendly Always Encrypted work (#3672). It unifies the remaining sync/async method pairs in the command path (
SqlCommand.Encryption.cs,EnclaveDelegate) into singleValueTaskimplementations that takebool isAsyncand branch only at the I/O call. There is no public API change. Severity is P3: the work is maintainability-focused, but it touches sensitive ordering and connection-state constraints.Next Steps
PrepareForTransparentEncryption/Async,CompleteCachedQueryMetadataAsync,CompleteParameterEncryptionAsync,EnclaveDelegate.CreateEnclaveSession/Async, and the@TODOinRunExecuteReaderTdsWithTransparentParameterEncryption.