File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -95,7 +95,7 @@ public void LocalCacheSizeInMegabytesSetting()
9595 new [ ] { 123u , 456u , 789u } ) ;
9696
9797 [ TestMethod ]
98- public void ForceCacheMissBitMaskSetting ( )
98+ public void ForceCacheMissPercentageSetting ( )
9999 => TestBasicSetting (
100100 nameof ( PluginSettings . ForceCacheMissPercentage ) ,
101101 pluginSettings => pluginSettings . ForceCacheMissPercentage ,
Original file line number Diff line number Diff line change @@ -355,11 +355,15 @@ private async Task<CacheResult> GetCacheResultInnerAsync(BuildRequestData buildR
355355 if ( Settings . ForceCacheMissPercentage != 0 )
356356 {
357357 // use a hash of the project id so that it is repeatable
358- #pragma warning disable CA1850 // ComputeHash is not in net472
358+
359+ #if NETFRAMEWORK
359360 using SHA256 hasher = SHA256 . Create ( ) ;
360361 byte [ ] projectHash = hasher . ComputeHash ( Encoding . UTF8 . GetBytes ( nodeContext . Id ) ) ;
362+ #else
363+ byte [ ] projectHash = SHA256 . HashData ( Encoding . UTF8 . GetBytes ( nodeContext . Id ) ) ;
364+ #endif
365+
361366 uint hashInt = BitConverter . ToUInt32 ( projectHash , 0 ) ;
362- #pragma warning restore CA1850
363367 if ( ( hashInt % 100 ) < Settings . ForceCacheMissPercentage )
364368 {
365369 logger . LogMessage ( $ "Forcing an otherwise 'cache hit' to be a 'cache miss' because of ForceCacheMissPercentage.") ;
You can’t perform that action at this time.
0 commit comments