internal static void ValidateLevels()
{
if (levelsValidated)
{
return;
}
bool level1 = !LocalAppContext.GetCachedSwitchValue(UseLegacyAccessibilityFeaturesSwitchName, ref useLegacyAccessibilityFeatures);
bool level2 = !LocalAppContext.GetCachedSwitchValue(UseLegacyAccessibilityFeatures2SwitchName, ref useLegacyAccessibilityFeatures2);
// 4.7.2 accessibility improvements are building upon the infrastructure introduced in 4.7.1,
// thus the application has to opt-in into 4.7.1 level in order to get the 4.7.2 level of support.
if (!level1 && level2)
{
throw new NotSupportedException(SR.GetString(SR.CombinationOfAccessibilitySwitchesNotSupported));
}
// If this code is executed concurrently, in the worst case we'll throw the same exception on each thread.
levelsValidated = true;
}