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
The
bufferparameter ofGetBytes/GetCharsshould 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:
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