File tree 2 files changed +12
-0
lines changed
src/Microsoft.Data.SqlClient
src/Microsoft/Data/SqlClient
tests/ManualTests/SQL/DataReaderTest
2 files changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -624,6 +624,10 @@ internal SqlBinary SqlBinary
624
624
{
625
625
if ( StorageType . SqlBinary == _type )
626
626
{
627
+ if ( IsNull )
628
+ {
629
+ return SqlBinary . Null ;
630
+ }
627
631
return ( SqlBinary ) _object ;
628
632
}
629
633
return ( SqlBinary ) SqlValue ; // anything else we haven't thought of goes through boxing.
Original file line number Diff line number Diff line change @@ -282,6 +282,14 @@ public static void CheckNullRowVersionIsBDNull()
282
282
Assert . IsType < DBNull > ( result ) ;
283
283
Assert . Equal ( result , reader . GetFieldValue < DBNull > ( 0 ) ) ;
284
284
Assert . Throws < SqlNullValueException > ( ( ) => reader . GetFieldValue < byte [ ] > ( 0 ) ) ;
285
+
286
+ SqlBinary binary = reader . GetSqlBinary ( 0 ) ;
287
+ Assert . True ( binary . IsNull ) ;
288
+
289
+ SqlBytes bytes = reader . GetSqlBytes ( 0 ) ;
290
+ Assert . True ( bytes . IsNull ) ;
291
+ Assert . Null ( bytes . Buffer ) ;
292
+
285
293
}
286
294
finally
287
295
{
You can’t perform that action at this time.
0 commit comments