Skip to content

Conversation

@priyankatiwari08
Copy link
Contributor

Description

This Pull Request addresses issue #3716 by introducing a null check for systemParams, which stores the system-level parameters for SQL RPC (Remote Procedure Call) operations. In batch scenarios, certain SQL RPC calls may not include system parameters, and this change ensures proper handling in such cases.

Issues

#3716

@priyankatiwari08 priyankatiwari08 requested a review from a team as a code owner November 6, 2025 17:37
Copilot AI review requested due to automatic review settings November 6, 2025 17:37
Copy link
Contributor

Copilot AI left a 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 pull request adds a null check for systemParams before accessing its Length property in the parameter encryption metadata retrieval logic. This defensive programming change prevents a potential NullReferenceException when processing RPC batch commands.

Key Changes

  • Added null check for _RPCList[i].systemParams before accessing its Length property in TryFetchInputParameterEncryptionInfo method
Comments suppressed due to low confidence (1)

src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlCommand.Encryption.cs:1296

  • The added null check for systemParams lacks test coverage. Based on the code analysis, systemParams is initialized through GetRPCObject() which always allocates and initializes the array when systemParamCount > 0. However, a newly constructed _SqlRPC object (as seen in AddBatchCommand line 21) has systemParams initially null. A test case should be added that exercises the batch RPC mode encryption path with an RPC object that has not yet had its systemParams initialized to verify this defensive check works correctly.
                    if (_RPCList[i].systemParams != null && _RPCList[i].systemParams.Length > 1)

Copy link
Contributor

@paulmedynski paulmedynski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need some tests for this.

@paulmedynski paulmedynski self-assigned this Nov 6, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

Copy link
Contributor

@apoorvdeshmukh apoorvdeshmukh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are build failures while compiling the tests.

…SqlClient.ManualTesting.Tests.csproj

Co-authored-by: Copilot <[email protected]>
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

@apoorvdeshmukh apoorvdeshmukh self-assigned this Nov 11, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

@cheenamalhotra cheenamalhotra removed the P1 label Nov 21, 2025
…apterIssue

r Please enter a commit message to explain why this merge is necessary,
Merging with main
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 6 comments.

@priyankatiwari08
Copy link
Contributor Author

@dotnet-policy-service agree company="Microsoft"

@codecov
Copy link

codecov bot commented Dec 4, 2025

Codecov Report

❌ Patch coverage is 0% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 69.84%. Comparing base (995df25) to head (6137517).
⚠️ Report is 10 commits behind head on main.

Files with missing lines Patch % Lines
.../Microsoft/Data/SqlClient/SqlCommand.Encryption.cs 0.00% 1 Missing ⚠️

❗ There is a different number of reports uploaded between BASE (995df25) and HEAD (6137517). Click for more details.

HEAD has 1 upload less than BASE
Flag BASE (995df25) HEAD (6137517)
addons 1 0
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3749      +/-   ##
==========================================
- Coverage   76.61%   69.84%   -6.77%     
==========================================
  Files         274      268       -6     
  Lines       43393    66432   +23039     
==========================================
+ Hits        33247    46402   +13155     
- Misses      10146    20030    +9884     
Flag Coverage Δ
addons ?
netcore 69.86% <0.00%> (-6.82%) ⬇️
netfx 69.22% <0.00%> (-6.97%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@priyankatiwari08 priyankatiwari08 merged commit c23fed6 into main Dec 9, 2025
250 checks passed
@priyankatiwari08 priyankatiwari08 deleted the dev/prtiwar/SqlDataAdapterIssue branch December 9, 2025 17:10
@paulmedynski paulmedynski added this to the 7.0.0-preview4 milestone Dec 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants