@@ -38,13 +38,13 @@ public void Test_StringPool_Cctor_Ok(int minimumSize, int x, int y, int size)
38
38
39
39
Assert . AreEqual ( size , pool . Size ) ;
40
40
41
- Array maps = ( Array ) typeof ( StringPool ) . GetField ( "maps" , BindingFlags . Instance | BindingFlags . NonPublic ) . GetValue ( pool ) ;
41
+ Array maps = ( Array ) typeof ( StringPool ) . GetField ( "maps" , BindingFlags . Instance | BindingFlags . NonPublic ) ! . GetValue ( pool ) ! ;
42
42
43
43
Assert . AreEqual ( x , maps . Length ) ;
44
44
45
- Type bucketType = Type . GetType ( "Microsoft.Toolkit.HighPerformance.Buffers.StringPool+FixedSizePriorityMap, Microsoft.Toolkit.HighPerformance" ) ;
45
+ Type bucketType = Type . GetType ( "Microsoft.Toolkit.HighPerformance.Buffers.StringPool+FixedSizePriorityMap, Microsoft.Toolkit.HighPerformance" ) ! ;
46
46
47
- int [ ] buckets = ( int [ ] ) bucketType . GetField ( "buckets" , BindingFlags . Instance | BindingFlags . NonPublic ) . GetValue ( maps . GetValue ( 0 ) ) ;
47
+ int [ ] buckets = ( int [ ] ) bucketType . GetField ( "buckets" , BindingFlags . Instance | BindingFlags . NonPublic ) ! . GetValue ( maps . GetValue ( 0 ) ) ! ;
48
48
49
49
Assert . AreEqual ( y , buckets . Length ) ;
50
50
}
@@ -64,7 +64,7 @@ public void Test_StringPool_Cctor_Fail(int size)
64
64
}
65
65
catch ( ArgumentOutOfRangeException e )
66
66
{
67
- var cctor = typeof ( StringPool ) . GetConstructor ( new [ ] { typeof ( int ) } ) ;
67
+ var cctor = typeof ( StringPool ) . GetConstructor ( new [ ] { typeof ( int ) } ) ! ;
68
68
69
69
Assert . AreEqual ( cctor . GetParameters ( ) [ 0 ] . Name , e . ParamName ) ;
70
70
}
@@ -158,7 +158,7 @@ public void Test_StringPool_Add_Overwrite()
158
158
[ MethodImpl ( MethodImplOptions . NoInlining ) ]
159
159
private static string ToStringNoInlining ( object obj )
160
160
{
161
- return obj . ToString ( ) ;
161
+ return obj . ToString ( ) ! ;
162
162
}
163
163
164
164
[ TestCategory ( "StringPool" ) ]
@@ -285,15 +285,15 @@ public void Test_StringPool_GetOrAdd_Overflow()
285
285
}
286
286
287
287
// Get the buckets
288
- Array maps = ( Array ) typeof ( StringPool ) . GetField ( "maps" , BindingFlags . Instance | BindingFlags . NonPublic ) . GetValue ( pool ) ;
288
+ Array maps = ( Array ) typeof ( StringPool ) . GetField ( "maps" , BindingFlags . Instance | BindingFlags . NonPublic ) ! . GetValue ( pool ) ! ;
289
289
290
- Type bucketType = Type . GetType ( "Microsoft.Toolkit.HighPerformance.Buffers.StringPool+FixedSizePriorityMap, Microsoft.Toolkit.HighPerformance" ) ;
291
- FieldInfo timestampInfo = bucketType . GetField ( "timestamp" , BindingFlags . Instance | BindingFlags . NonPublic ) ;
290
+ Type bucketType = Type . GetType ( "Microsoft.Toolkit.HighPerformance.Buffers.StringPool+FixedSizePriorityMap, Microsoft.Toolkit.HighPerformance" ) ! ;
291
+ FieldInfo timestampInfo = bucketType . GetField ( "timestamp" , BindingFlags . Instance | BindingFlags . NonPublic ) ! ;
292
292
293
293
// Force the timestamp to be the maximum value, or the test would take too long
294
294
for ( int i = 0 ; i < maps . LongLength ; i ++ )
295
295
{
296
- object map = maps . GetValue ( i ) ;
296
+ object map = maps . GetValue ( i ) ! ;
297
297
298
298
timestampInfo . SetValue ( map , uint . MaxValue ) ;
299
299
@@ -305,16 +305,16 @@ public void Test_StringPool_GetOrAdd_Overflow()
305
305
306
306
_ = pool . GetOrAdd ( text ) ;
307
307
308
- Type heapEntryType = Type . GetType ( "Microsoft.Toolkit.HighPerformance.Buffers.StringPool+FixedSizePriorityMap+HeapEntry, Microsoft.Toolkit.HighPerformance" ) ;
308
+ Type heapEntryType = Type . GetType ( "Microsoft.Toolkit.HighPerformance.Buffers.StringPool+FixedSizePriorityMap+HeapEntry, Microsoft.Toolkit.HighPerformance" ) ! ;
309
309
310
310
foreach ( var map in maps )
311
311
{
312
312
// Get the heap for each bucket
313
- Array heapEntries = ( Array ) bucketType . GetField ( "heapEntries" , BindingFlags . Instance | BindingFlags . NonPublic ) . GetValue ( map ) ;
314
- FieldInfo fieldInfo = heapEntryType . GetField ( "Timestamp" ) ;
313
+ Array heapEntries = ( Array ) bucketType . GetField ( "heapEntries" , BindingFlags . Instance | BindingFlags . NonPublic ) ! . GetValue ( map ) ! ;
314
+ FieldInfo fieldInfo = heapEntryType . GetField ( "Timestamp" ) ! ;
315
315
316
316
// Extract the array with the timestamps in the heap nodes
317
- uint [ ] array = heapEntries . Cast < object > ( ) . Select ( entry => ( uint ) fieldInfo . GetValue ( entry ) ) . ToArray ( ) ;
317
+ uint [ ] array = heapEntries . Cast < object > ( ) . Select ( entry => ( uint ) fieldInfo . GetValue ( entry ) ! ) . ToArray ( ) ;
318
318
319
319
static bool IsMinHeap ( uint [ ] array )
320
320
{
0 commit comments