@@ -675,6 +675,12 @@ public async Task TryConvertTo_Ok()
675675 Assert . Equal ( [ 1 , 2 , 3 , 4 , 5 ] , entity . Header ) ;
676676 Assert . Equal ( [ 3 , 4 ] , entity . Body ) ;
677677
678+ // null
679+ Assert . Equal ( ( byte ) 0x0 , entity . Value16 ) ;
680+
681+ // null
682+ Assert . Equal ( ( byte ) 0x0 , entity . Value17 ) ;
683+
678684 // byte
679685 Assert . Equal ( 0x1 , entity . Value15 ) ;
680686
@@ -1426,6 +1432,12 @@ class MockEntity
14261432
14271433 [ DataPropertyConverter ( Type = typeof ( byte ) , Offset = 0 , Length = 1 ) ]
14281434 public byte Value15 { get ; set ; }
1435+
1436+ [ DataPropertyConverter ( Type = typeof ( byte ) , ConverterType = typeof ( MockNullConverter ) , Offset = 0 , Length = 1 ) ]
1437+ public byte Value16 { get ; set ; }
1438+
1439+ [ DataPropertyConverter ( Type = typeof ( byte [ ] ) , Offset = 0 , Length = 1 ) ]
1440+ public byte Value17 { get ; set ; }
14291441 }
14301442
14311443 class MockSocketDataConverter : DataConverter < MockEntity >
@@ -1444,6 +1456,14 @@ protected override bool Parse(ReadOnlyMemory<byte> data, MockEntity entity)
14441456 }
14451457 }
14461458
1459+ class MockNullConverter : IDataPropertyConverter
1460+ {
1461+ public object ? Convert ( ReadOnlyMemory < byte > data )
1462+ {
1463+ return null ;
1464+ }
1465+ }
1466+
14471467 class FooConverter ( string name ) : IDataPropertyConverter
14481468 {
14491469 public object ? Convert ( ReadOnlyMemory < byte > data )
0 commit comments