@@ -401,6 +401,21 @@ static int ToScaledInt(double value, int scale)
401401 var scaled = value * scale ;
402402 return scaled >= int . MaxValue ? int . MaxValue : ( int ) scaled ;
403403 }
404+
405+ bool DisableCore ( MetricTags . DebuggerMemoryPressureDisabledReason reason )
406+ {
407+ if ( IsDisposed ( ) || IsDisabled ( ) )
408+ {
409+ return false ;
410+ }
411+
412+ Volatile . Write ( ref _disabled , 1 ) ;
413+ Volatile . Write ( ref _isHighPressure , false ) ;
414+ Volatile . Write ( ref _currentMemoryUsagePercentTenths , 0 ) ;
415+ Volatile . Write ( ref _gen2CollectionsPerSecondHundredths , 0 ) ;
416+ _onDisabled ( reason ) ;
417+ return true ;
418+ }
404419 }
405420
406421 [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
@@ -409,22 +424,6 @@ private bool IsStale(long nowMs, long lastRefreshMs)
409424 return ( nowMs - lastRefreshMs ) >= _staleThresholdMs ;
410425 }
411426
412- // Only ever called from inside the CAS-guarded Refresh, so no synchronization is required.
413- private bool DisableCore ( MetricTags . DebuggerMemoryPressureDisabledReason reason )
414- {
415- if ( IsDisposed ( ) || IsDisabled ( ) )
416- {
417- return false ;
418- }
419-
420- Volatile . Write ( ref _disabled , 1 ) ;
421- Volatile . Write ( ref _isHighPressure , false ) ;
422- Volatile . Write ( ref _currentMemoryUsagePercentTenths , 0 ) ;
423- Volatile . Write ( ref _gen2CollectionsPerSecondHundredths , 0 ) ;
424- _onDisabled ( reason ) ;
425- return true ;
426- }
427-
428427 [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
429428 private bool IsDisposed ( )
430429 {
0 commit comments