Skip to content
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

Do not add parameters for sp_describe_parameter_encryption when not provided #1115

Merged
merged 9 commits into from Jul 10, 2021
Merged

Do not add parameters for sp_describe_parameter_encryption when not provided #1115

merged 9 commits into from Jul 10, 2021

Conversation

johnnypham
Copy link
Contributor

@johnnypham johnnypham commented Jun 15, 2021

Fixes #1105

The exception occurs when the driver tries to execute sp_describe_parameter_encryption but no user parameters have been provided.

Current behaviour for always encrypted with secure enclaves:

When executing a stored procedure that does not require an input parameter:

  • unexpected: fails with NRE. Driver attempts to add parameters to execute sp_describe_parameter_encryption but parameters are null. Should succeed by sending empty parameter list for sp_describe_parameter_encryption

When executing a stored procedure that requires an input parameter but none are provided by the user:

  • unexpected: fails with NRE. Driver attempts to add parameters to execute sp_describe_parameter_encryption but parameters are null. Should fail with "Microsoft.Data.SqlClient.SqlException (0x80131904): Procedure or function '[name of sp]' expects parameter '@[name of param]', which was not supplied."

This change fixes both unexpected behaviours above.

SqlClient v4.0 automation moved this from In progress to Reviewer approved Jul 8, 2021
@johnnypham johnnypham merged commit ae693c3 into dotnet:main Jul 10, 2021
SqlClient v4.0 automation moved this from Reviewer approved to Done Jul 10, 2021
@johnnypham johnnypham deleted the issue1105 branch July 10, 2021 01:19
DavoudEshtehari pushed a commit to Wraith2/SqlClient that referenced this pull request Sep 1, 2021
…rovided (dotnet#1115)

* Update SqlCommand.cs

* only execute sp_describe_parameter_encryption if parameters not empty

* add test

* improve test coverage

* only go through parameters if not null

* revert previous attempt

* Update ApiShould.cs

* Update ApiShould.cs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
3 participants