Repository navigation
Conversation
Use the connection encoding to count transmitted ANSI bytes before selecting MAX metadata. This prevents UTF-8 values below 8000 characters but above 8000 bytes from producing invalid VARCHAR declarations and RPC framing. Cover encoded byte boundaries, inferred sizes, truncation, offsets and SqlString values with unit regressions. Add SQL Server round-trip tests for text, stored procedure and prepared commands with sync and async execution. Validation: 1502 unit tests and 206 parameter functional tests passed; the Windows-only integrated authentication test was excluded on Linux. All 19 wire scenarios passed, including replay of the original EF command. Driver builds passed for net10.0 and net462. Live SQL Server tests compile but remain unverified locally. Fixes dotnet#2035
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
Author
|
@dotnet-policy-service agree |
This branch has not been deployed
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.
AI Disclaimer
I'm the original reporter of this issue and the test case 3 years ago. AI (Codex/6.1-Sol) now helped me create this PR which apparently fixes this issue, but I can't say that I properly understand it. However, I thought it could be at least a helpful starting point.
Description
ANSI parameter metadata can be invalid when a value fits within 8,000 characters but exceeds 8,000 bytes in the connection encoding. For example, 4,001
écharacters occupy 8,002 UTF-8 bytes. The driver currently selects non-MAX metadata using the character count, causing SQL Server to reject the RPC with an invalid data length or metadata length error.This change counts transmitted ANSI bytes using the connection’s negotiated encoding before selecting MAX metadata. The calculation respects parameter size and offset. Public APIs and the character-based semantics of
SqlParameter.Sizeremain unchanged.Adds unit regression coverage and SQL Server round-trip tests. Database tests use unique database names and clean up their resources.
Issues
Fixes #2035.
Testing
SqlStringvalues.Both comparison workflows report success when their expected outcomes are verified; the baseline’s green status means the expected failures were confirmed.
Additional local validation:
net10.0andnet462.The fork-specific comparison workflows are separate from this PR. Windows runtime validation remains for upstream CI.