Skip to content

Conversation

@Wraith2
Copy link
Contributor

@Wraith2 Wraith2 commented Jan 8, 2026

fixes #3871

There is an edge case int TdsParserStateObject.TryReadPlpBytes in continue enabled mode where the attempt to fetch the snapshot stored buffer when there is none available causes the return of a null array reference and not an empty array. This introduces a temp variable and only uses the stored buffer in this case if it is non-null.

@dotnet/sqlclientdevteam can you run the CI please

/cc @kaiohenrique

@Wraith2 Wraith2 requested a review from a team as a code owner January 8, 2026 21:24
@mdaigle
Copy link
Contributor

mdaigle commented Jan 8, 2026

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 2 pipeline(s).

@kaiohenrique
Copy link

@kaiohenrique
Copy link

In the storage, is it possible the buffer is incompatible with the column datatype being read at the moment? I am thinking in something like that

Previous column stored byte[] array in snapshot (from VARCHAR data)
Empty NVARCHAR tries to retrieve char[] from snapshot
Cast fails => returns NULL

OR

Previous column stored char[] array in snapshot (from NVARCHAR data)
Empty VARCHAR tries to retrieve byte[] from snapshot
Cast fails => returns NULL

@Wraith2
Copy link
Contributor Author

Wraith2 commented Jan 8, 2026

Hello, @Wraith2 Should we also apply the fix here https://github.com/Wraith2/SqlClient/blob/fix-3871/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/TdsParser.cs#L13780?

If you can produce an example of it causing a failure. This code is both performance sensitive and very complex to reason about, i'd rather not make changes without good reason.

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.

Exception System.ArgumentNullException: Value cannot be null. (Parameter 'bytes') when UseCompatibilityAsyncBehaviour=false

3 participants