Skip to content

IDataRecord.GetBytes/GetChars should be annotated to allow a null buffer #44886

@chrarnoldus

Description

@chrarnoldus

The buffer parameter of GetBytes/GetChars should be annotated to allow null values. Currently in .NET 5.0.0 they are annotated to not allow null values (see #38810).

The documentation states:

If you pass a buffer that is null, GetChars returns the length of the field in characters.

Source: https://docs.microsoft.com/en-us/dotnet/api/system.data.idatarecord.getchars?view=net-5.0#remarks

In SqlClient the implementation does indeed conform to the documentation: https://github.com/dotnet/SqlClient/blob/f0572f3e9990b391d6102911fe12223e748e117b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlDataReader.cs#L1663

Metadata

Metadata

Assignees

Labels

area-System.Databreaking-changeIssue or PR that represents a breaking API or functional change over a previous release.bug

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions