static partial void PopulateDefaultValuesPartial(string platformIdentifier, string profile, int targetFrameworkVersion) { switch (platformIdentifier) { case ".NETFramework": { if (targetFrameworkVersion <= 40502) { LocalAppContext.DefineSwitchDefault(FrameworkAppContextSwitches.DoNotApplyLayoutRoundingToMarginsAndBorderThicknessSwitchName, true); } if (targetFrameworkVersion <= 40602) { LocalAppContext.DefineSwitchDefault(FrameworkAppContextSwitches.GridStarDefinitionsCanExceedAvailableSpaceSwitchName, true); } if (targetFrameworkVersion <= 40700) { LocalAppContext.DefineSwitchDefault(FrameworkAppContextSwitches.SelectionPropertiesCanLagBehindSelectionChangedEventSwitchName, true); } if (targetFrameworkVersion <= 40701) { LocalAppContext.DefineSwitchDefault(FrameworkAppContextSwitches.DoNotUseFollowParentWhenBindingToADODataRelationSwitchName, true); } // DDVSO:405199 // The standard behavior is to draw Text/PasswordBox selections via the adorner. // We want this to always be the case unless it is explicity changed, regardless of .NET target version. LocalAppContext.DefineSwitchDefault(FrameworkAppContextSwitches.UseAdornerForTextboxSelectionRenderingSwitchName, true); break; } } }
static partial void PopulateDefaultValuesPartial(string platformIdentifier, string profile, int version) { // When defining a new switch you should add it to the last known version. // For instance, if you are adding a switch in .NET 4.6 (the release after 4.5.2) you should defined your switch // like this: // if (version <= 40502) ... // This ensures that all previous versions of that platform (up-to 4.5.2) will get the old behavior by default // NOTE: When adding a default value for a switch please make sure that the default value is added to ALL of the existing platforms! // NOTE: When adding a new if statement for the version please ensure that ALL previous switches are enabled (ie. don't use else if) switch (platformIdentifier) { case ".NETCore": case ".NETFramework": { if (version <= 40601) { LocalAppContext.DefineSwitchDefault("Switch.System.Runtime.Serialization.DoNotUseTimeZoneInfo", true); } if (version <= 40602) { LocalAppContext.DefineSwitchDefault(System.Runtime.Serialization.LocalAppContextSwitches.DoNotUseEcmaScriptV6EscapeControlCharacterKeyString, true); } break; } } }
static partial void PopulateDefaultValuesPartial(string platformIdentifier, string profile, int version) { // When defining a new switch you should add it to the last known version. // For instance, if you are adding a switch in .NET 4.6 (the release after 4.5.2) you should defined your switch // like this: // if (version <= 40502) ... // This ensures that all previous versions of that platform (up-to 4.5.2) will get the old behavior by default // NOTE: When adding a default value for a switch please make sure that the default value is added to ALL of the existing platforms! // NOTE: When adding a new if statement for the version please ensure that ALL previous switches are enabled (ie. don't use else if) switch (platformIdentifier) { case ".NETCore": case ".NETFramework": { if (version <= 40502) { LocalAppContext.DefineSwitchDefault(LocalAppContextSwitches.DontEnableSchUseStrongCryptoName, true); } break; } case "WindowsPhone": case "WindowsPhoneApp": { if (version <= 80100) { LocalAppContext.DefineSwitchDefault(LocalAppContextSwitches.DontEnableSchUseStrongCryptoName, true); } break; } } }
static partial void PopulateDefaultValuesPartial(string platformIdentifier, string profile, int version) { // When defining a new switch you should add it to the last known version. // For instance, if you are adding a switch in .NET 4.6.1 (the release after 4.6) you should define your switch // like this: // if (version <= 40600) ... // This ensures that all previous versions of that platform (up-to 4.6) will get the old behavior by default // NOTE: When adding a default value for a switch please make sure that the default value is added to ALL of the existing platforms! // NOTE: When adding a new if statement for the version please ensure that ALL previous switches are enabled (i.e. don't use else if) switch (platformIdentifier) { case ".NETFramework": { if (version <= 40600) { LocalAppContext.DefineSwitchDefault(LocalAppContextSwitches.DontSupportReentrantFilterMessageSwitchName, true); LocalAppContext.DefineSwitchDefault(LocalAppContextSwitches.DoNotSupportSelectAllShortcutInMultilineTextBoxSwitchName, true); } if (version <= 40602) { LocalAppContext.DefineSwitchDefault(LocalAppContextSwitches.DoNotLoadLatestRichEditControlSwitchName, true); } break; } } }
static partial void PopulateDefaultValuesPartial(string platformIdentifier, string profile, int targetFrameworkVersion) { switch (platformIdentifier) { case ".NETFramework": { if (targetFrameworkVersion <= 40502) { LocalAppContext.DefineSwitchDefault(BaseAppContextSwitches.SwitchDoNotUseCulturePreservingDispatcherOperations, true); } if (targetFrameworkVersion <= 40700) { LocalAppContext.DefineSwitchDefault(BaseAppContextSwitches.SwitchUseSha1AsDefaultHashAlgorithmForDigitalSignatures, true); } } break; case ".NETCoreApp": { InitializeNetFxSwitchDefaultsForNetCoreRuntime(); } break; } // Ensure we set all the accessibility switch defaults AccessibilitySwitches.SetSwitchDefaults(platformIdentifier, targetFrameworkVersion); }
static partial void PopulateDefaultValuesPartial(string platformIdentifier, string profile, int version) { // When defining a new switch you should add it to the last known version. // For instance, if you are adding a switch in .NET 4.6.1 (the release after 4.6) you should define your switch // like this: // if (version <= 40600) ... // This ensures that all previous versions of that platform (up-to 4.6) will get the old behavior by default // NOTE: When adding a default value for a switch please make sure that the default value is added to ALL of the existing platforms! // NOTE: When adding a new if statement for the version please ensure that ALL previous switches are enabled (i.e. don't use else if) switch (platformIdentifier) { case ".NETFramework": { if (version <= 40700) { LocalAppContext.DefineSwitchDefault(LocalAppContextSwitches.UseLegacyAccessibilityFeaturesSwitchName, true); } if (version <= 40702) { LocalAppContext.DefineSwitchDefault(LocalAppContextSwitches.UseLegacyAccessibilityFeatures3SwitchName, true); } break; } } }
static partial void PopulateDefaultValuesPartial(string platformIdentifier, string profile, int version) { // When defining a new switch you should add it to the last known version. // For instance, if you are adding a switch in .NET 4.6 (the release after 4.5.2) you should defined your switch // like this: // if (version <= 40502) ... // This ensures that all previous versions of that platform (up-to 4.5.2) will get the old behavior by default // NOTE: When adding a default value for a switch please make sure that the default value is added to ALL of the existing platforms! // NOTE: When adding a new if statement for the version please ensure that ALL previous switches are enabled (ie. don't use else if) switch (platformIdentifier) { case ".NETCore": case ".NETFramework": { if (version <= 40502) { LocalAppContext.DefineSwitchDefault("Switch.System.Drawing.DontSupportPngFramesInIcons", true); } if (version <= 40701) { LocalAppContext.DefineSwitchDefault("Switch.System.Drawing.Text.DoNotRemoveGdiFontsResourcesFromFontCollection", true); } break; } } }
static partial void PopulateDefaultValuesPartial(string platformIdentifier, string profile, int version) { // When defining a new switch you should add it to the last known version. // For instance, if you are adding a switch in .NET 4.6 (the release after 4.5.2) you should defined your switch // like this: // if (version <= 40502) ... // This ensures that all previous versions of that platform (up-to 4.5.2) will get the old behavior by default // NOTE: When adding a default value for a switch please make sure that the default value is added to ALL of the existing platforms! // NOTE: When adding a new if statement for the version please ensure that ALL previous switches are enabled (ie. don't use else if) switch (platformIdentifier) { case ".NETCore": case ".NETFramework": { if (version <= 40700) { LocalAppContext.DefineSwitchDefault(LocalAppContextSwitches.SwitchXmlUseInsecureHashAlgorithms, true); LocalAppContext.DefineSwitchDefault(LocalAppContextSwitches.SwitchCmsUseInsecureHashAlgorithms, true); } if (version <= 40702) { LocalAppContext.DefineSwitchDefault(LocalAppContextSwitches.SwitchEnvelopedCmsUseLegacyDefaultAlgorithm, true); } break; } } // At this point we should read the overrides if any are defined PopulateOverrideValuesPartial(); }
static partial void PopulateDefaultValuesPartial(string platformIdentifier, string profile, int targetFrameworkVersion) { switch (platformIdentifier) { case ".NETFramework": { // Apps targetting .NET Framework version <= 4.6.1 will have to opt-in to Per Monitor DPI Changes using // this switch in app.config. if (targetFrameworkVersion <= 40601) { LocalAppContext.DefineSwitchDefault(CoreAppContextSwitches.DoNotScaleForDpiChangesSwitchName, true); } if (targetFrameworkVersion <= 40602) { LocalAppContext.DefineSwitchDefault(CoreAppContextSwitches.OverrideExceptionWithNullReferenceExceptionName, true); } if (targetFrameworkVersion <= 40700) { LocalAppContext.DefineSwitchDefault(CoreAppContextSwitches.UseLegacyAccessibilityFeaturesSwitchName, true); } break; } } }
// Token: 0x06000259 RID: 601 RVA: 0x0000606C File Offset: 0x0000426C private static void PopulateDefaultValuesPartial(string platformIdentifier, string profile, int version) { if (platformIdentifier == ".NETFramework") { if (version <= 40502) { LocalAppContext.DefineSwitchDefault("Switch.MS.Internal.DoNotApplyLayoutRoundingToMarginsAndBorderThickness", true); } if (version <= 40602) { LocalAppContext.DefineSwitchDefault("Switch.System.Windows.Controls.Grid.StarDefinitionsCanExceedAvailableSpace", true); } if (version <= 40700) { LocalAppContext.DefineSwitchDefault("Switch.System.Windows.Controls.TabControl.SelectionPropertiesCanLagBehindSelectionChangedEvent", true); } if (version <= 40701) { LocalAppContext.DefineSwitchDefault("Switch.System.Windows.Data.DoNotUseFollowParentWhenBindingToADODataRelation", true); } if (40000 <= version && version <= 40702) { LocalAppContext.DefineSwitchDefault("Switch.System.Windows.Data.Binding.IListIndexerHidesCustomIndexer", true); } if (version <= 40800) { LocalAppContext.DefineSwitchDefault("Switch.System.Windows.Controls.SelectorUpdatesSelectionPropertiesWhenDisconnected", true); } LocalAppContext.DefineSwitchDefault("Switch.System.Windows.Controls.Text.UseAdornerForTextboxSelectionRendering", true); } }
static partial void PopulateDefaultValuesPartial(string platformIdentifier, string profile, int targetFrameworkVersion) { switch (platformIdentifier) { case ".NETFramework": { if (targetFrameworkVersion <= 40601) { LocalAppContext.DefineSwitchDefault(CoreAppContextSwitches.DoNotScaleForDpiChangesSwitchName, true); } if (targetFrameworkVersion <= 40602) { LocalAppContext.DefineSwitchDefault(CoreAppContextSwitches.OverrideExceptionWithNullReferenceExceptionName, true); } if (targetFrameworkVersion <= 40702) { LocalAppContext.DefineSwitchDefault(CoreAppContextSwitches.DoNotUsePresentationDpiCapabilityTier2OrGreaterSwitchName, true); } break; } case ".NETCoreApp": { InitializeNetFxSwitchDefaultsForNetCoreRuntime(); } break; } }
static partial void PopulateDefaultValuesPartial(string platformIdentifier, string profile, int version) { // When defining a new switch you should add it to the last known version. // For instance, if you are adding a switch in .NET 4.6 (the release after 4.5.2) you should defined your switch // like this: // if (version <= 40502) ... // This ensures that all previous versions of that platform (up-to 4.5.2) will get the old behavior by default // NOTE: When adding a default value for a switch please make sure that the default value is added to ALL of the existing platforms! // NOTE: When adding a new if statement for the version please ensure that ALL previous switches are enabled (ie. don't use else if) switch (platformIdentifier) { case ".NETCore": case ".NETFramework": { if (version <= 40601) { LocalAppContext.DefineSwitchDefault(LocalAppContextSwitches.AesCryptoServiceProviderDontCorrectlyResetDecryptorStr, true); } if (version <= 40702) { LocalAppContext.DefineSwitchDefault(LocalAppContextSwitches.SwitchCryptographyUseLegacyFipsThrow, true); } break; } } }
static partial void PopulateDefaultValuesPartial(string platformIdentifier, string profile, int version) { // When defining a new switch you should add it to the last known version. // For instance, if you are adding a switch in .NET 4.6 (the release after 4.5.2) you should defined your switch // like this: // if (version <= 40502) ... // This ensures that all previous versions of that platform (up-to 4.5.2) will get the old behavior by default // NOTE: When adding a default value for a switch please make sure that the default value is added to ALL of the existing platforms! // NOTE: When adding a new if statement for the version please ensure that ALL previous switches are enabled (ie. don't use else if) switch (platformIdentifier) { case ".NETCore": case ".NETFramework": { if (version <= 40502) { LocalAppContextSwitches.SetDefaultsLessOrEqual_452(); } if (version <= 40601) { LocalAppContextSwitches.SetDefaultsLessOrEqual_461(); } if (version <= 40602) { // Define the switches that should be true for 4.6.2 or less, false for 4.6.3+. LocalAppContext.DefineSwitchDefault(LocalAppContextSwitches.DisableUsingServicePointManagerSecurityProtocolsString, true); } break; } } }
static partial void PopulateDefaultValuesPartial(string platformIdentifier, string profile, int version) { // When defining a new switch you should add it to the last known version. // For instance, if you are adding a switch in .NET 4.6 (the release after 4.5.2) you should defined your switch // like this: // if (version <= 40502) ... // This ensures that all previous versions of that platform (up-to 4.5.2) will get the old behavior by default // NOTE: When adding a default value for a switch please make sure that the default value is added to ALL of the existing platforms! // NOTE: When adding a new if statement for the version please ensure that ALL previous switches are enabled (ie. don't use else if) switch (platformIdentifier) { case ".NETCore": case ".NETFramework": { if (version <= 40502) { LocalAppContext.DefineSwitchDefault(LocalAppContextSwitches.DontEnableSchUseStrongCryptoName, true); } if (version <= 40601) { LocalAppContext.DefineSwitchDefault(LocalAppContextSwitches.MemberDescriptorEqualsReturnsFalseIfEquivalentName, true); } if (version <= 40602) { LocalAppContext.DefineSwitchDefault(LocalAppContextSwitches.DontEnableSystemDefaultTlsVersionsName, true); LocalAppContext.DefineSwitchDefault(LocalAppContextSwitches.DontEnableTlsAlertsName, true); } if (version <= 40700) { LocalAppContext.DefineSwitchDefault(LocalAppContextSwitches.DoNotCatchSerialStreamThreadExceptionsName, true); } if (version <= 40701) { LocalAppContext.DefineSwitchDefault(LocalAppContextSwitches.DontEnableStrictRFC3986ReservedCharacterSetsName, true); LocalAppContext.DefineSwitchDefault(LocalAppContextSwitches.DontKeepUnicodeBidiFormattingCharactersName, true); LocalAppContext.DefineSwitchDefault(LocalAppContextSwitches.DoNotUseNativeZipLibraryForDecompressionName, true); } break; } case "WindowsPhone": case "WindowsPhoneApp": { if (version <= 80100) { LocalAppContext.DefineSwitchDefault(LocalAppContextSwitches.DontEnableSchUseStrongCryptoName, true); LocalAppContext.DefineSwitchDefault(LocalAppContextSwitches.DontEnableSystemDefaultTlsVersionsName, true); LocalAppContext.DefineSwitchDefault(LocalAppContextSwitches.DontEnableTlsAlertsName, true); } break; } } }
/// <summary> /// This is the full set of .NET Framework <see cref="AppContext"/> in <see cref="BaseAppContextSwitches"/>. These are being initialized /// to <code>false</code> to ensure that the corresponding functionality will be treated as if it is enabled by default on .NET Core. /// </summary> private static void InitializeNetFxSwitchDefaultsForNetCoreRuntime() { LocalAppContext.DefineSwitchDefault(BaseAppContextSwitches.SwitchDoNotUseCulturePreservingDispatcherOperations, false); LocalAppContext.DefineSwitchDefault(BaseAppContextSwitches.SwitchUseSha1AsDefaultHashAlgorithmForDigitalSignatures, false); LocalAppContext.DefineSwitchDefault(BaseAppContextSwitches.SwitchDoNotInvokeInWeakEventTableShutdownListener, false); LocalAppContext.DefineSwitchDefault(BaseAppContextSwitches.SwitchEnableCleanupSchedulingImprovements, false); LocalAppContext.DefineSwitchDefault(BaseAppContextSwitches.SwitchEnableWeakEventMemoryImprovements, false); }
static partial void PopulateDefaultValuesPartial(string platformIdentifier, string profile, int targetFrameworkVersion) { switch (platformIdentifier) { case ".NETFramework": { if (targetFrameworkVersion <= 40502) { LocalAppContext.DefineSwitchDefault(FrameworkAppContextSwitches.DoNotApplyLayoutRoundingToMarginsAndBorderThicknessSwitchName, true); } if (targetFrameworkVersion <= 40602) { LocalAppContext.DefineSwitchDefault(FrameworkAppContextSwitches.GridStarDefinitionsCanExceedAvailableSpaceSwitchName, true); } if (targetFrameworkVersion <= 40700) { LocalAppContext.DefineSwitchDefault(FrameworkAppContextSwitches.SelectionPropertiesCanLagBehindSelectionChangedEventSwitchName, true); } if (targetFrameworkVersion <= 40701) { LocalAppContext.DefineSwitchDefault(FrameworkAppContextSwitches.DoNotUseFollowParentWhenBindingToADODataRelationSwitchName, true); } if (40000 <= targetFrameworkVersion && targetFrameworkVersion <= 40702) { LocalAppContext.DefineSwitchDefault(FrameworkAppContextSwitches.IListIndexerHidesCustomIndexerSwitchName, true); } if (targetFrameworkVersion <= 40800) { LocalAppContext.DefineSwitchDefault(FrameworkAppContextSwitches.SelectorUpdatesSelectionPropertiesWhenDisconnectedSwitchName, true); } #if Preserve48Regression_SelectorInDataGridUpdatesSelectionPropertiesWhenDisconnected // 4.8 shipped with a regression. Uncommenting this clause would preserve // the bad behavior for apps targeting 4.8. However, .NET Servicing // shiproom decided it's better to fix the behavior. An app that // targets 4.8 and depends on the bad behavior can still get it // by setting the switch to true. if (targetFrameworkVersion == 40800) { LocalAppContext.DefineSwitchDefault(FrameworkAppContextSwitches.SelectorInDataGridUpdatesSelectionPropertiesWhenDisconnectedSwitchName, true); } #endif // The AppContext analyzer expects an if statement here, we should have named the switch 'DoNotUseAdorner' and not included this line at all - by default, switches get set to 'false' // Because this was realized after we shipped, we are going to disable the warning for this switch. #pragma warning disable BCL0012 // DDVSO:405199 // The standard behavior is to draw Text/PasswordBox selections via the adorner. // We want this to always be the case unless it is explicity changed, regardless of .NET target version. LocalAppContext.DefineSwitchDefault(FrameworkAppContextSwitches.UseAdornerForTextboxSelectionRenderingSwitchName, true); #pragma warning restore BCL0012 break; } } }
// Token: 0x0600025D RID: 605 RVA: 0x00006154 File Offset: 0x00004354 public static bool IsSwitchEnabled(string switchName) { bool result; if (LocalAppContext.s_canForwardCalls && LocalAppContext.TryGetSwitchFromCentralAppContext(switchName, out result)) { return(result); } return(LocalAppContext.IsSwitchEnabledLocal(switchName)); }
// Token: 0x06000261 RID: 609 RVA: 0x00006274 File Offset: 0x00004474 private static bool GetCachedSwitchValueInternal(string switchName, ref int switchValue) { if (LocalAppContext.DisableCaching) { return(LocalAppContext.IsSwitchEnabled(switchName)); } bool flag = LocalAppContext.IsSwitchEnabled(switchName); switchValue = (flag ? 1 : -1); return(flag); }
private static bool GetCachedSwitchValueInternal(string switchName, ref int switchValue) { if (LocalAppContext.DisableCaching) { return(LocalAppContext.IsSwitchEnabled(switchName)); } bool isEnabled = LocalAppContext.IsSwitchEnabled(switchName); switchValue = isEnabled ? 1 /*true*/ : -1 /*false*/; return(isEnabled); }
static partial void PopulateDefaultValuesPartial(string platformIdentifier, string profile, int targetFrameworkVersion) { switch (platformIdentifier) { case ".NETFramework": { if (targetFrameworkVersion <= 40502) { LocalAppContext.DefineSwitchDefault(BaseAppContextSwitches.SwitchDoNotUseCulturePreservingDispatcherOperations, true); } break; } } }
static partial void PopulateDefaultValuesPartial(string platformIdentifier, string profile, int targetFrameworkVersion) { switch (platformIdentifier) { case ".NETFramework": { if (targetFrameworkVersion <= 40701) { LocalAppContext.DefineSwitchDefault(BuildTasksAppContextSwitches.DoNotUseSha256ForMarkupCompilerChecksumAlgorithmSwitchName, true); } break; } } }
static partial void PopulateDefaultValuesPartial(string platformIdentifier, string profile, int targetFrameworkVersion) { switch (platformIdentifier) { case ".NETFramework": { if (targetFrameworkVersion <= 40502) { LocalAppContext.DefineSwitchDefault(FrameworkAppContextSwitches.DoNotApplyLayoutRoundingToMarginsAndBorderThicknessSwitchName, true); } break; } } }
static partial void PopulateDefaultValuesPartial(string platformIdentifier, string profile, int version) { // When defining a new switch you should add it to the last known version. // For instance, if you are adding a switch in .NET 4.6.1 (the release after 4.6) you should define your switch // like this: // if (version <= 40600) ... // This ensures that all previous versions of that platform (up-to 4.6) will get the old behavior by default // NOTE: When adding a default value for a switch please make sure that the default value is added to ALL of the existing platforms! // NOTE: When adding a new if statement for the version please ensure that ALL previous switches are enabled (i.e. don't use else if) switch (platformIdentifier) { case ".NETFramework": { if (version <= 40600) { LocalAppContext.DefineSwitchDefault(LocalAppContextSwitches.DontSupportReentrantFilterMessageSwitchName, true); LocalAppContext.DefineSwitchDefault(LocalAppContextSwitches.DoNotSupportSelectAllShortcutInMultilineTextBoxSwitchName, true); } if (version <= 40602) { LocalAppContext.DefineSwitchDefault(LocalAppContextSwitches.DoNotLoadLatestRichEditControlSwitchName, true); } if (version <= 40700) { LocalAppContext.DefineSwitchDefault(AccessibilityImprovements.UseLegacyAccessibilityFeaturesSwitchName, true); } if (version <= 40701) { LocalAppContext.DefineSwitchDefault(LocalAppContextSwitches.UseLegacyContextMenuStripSourceControlValueSwitchName, true); LocalAppContext.DefineSwitchDefault(LocalAppContextSwitches.DomainUpDownUseLegacyScrollingSwitchName, true); LocalAppContext.DefineSwitchDefault(LocalAppContextSwitches.AllowUpdateChildControlIndexForTabControlsSwitchName, true); LocalAppContext.DefineSwitchDefault(AccessibilityImprovements.UseLegacyAccessibilityFeatures2SwitchName, true); } if (version <= 40702) { LocalAppContext.DefineSwitchDefault(AccessibilityImprovements.UseLegacyAccessibilityFeatures3SwitchName, true); LocalAppContext.DefineSwitchDefault(LocalAppContextSwitches.UseLegacyImagesSwitchName, true); LocalAppContext.DefineSwitchDefault(LocalAppContextSwitches.EnableVisualStyleValidationSwitchName, true); } // When this switch is set to false, it enables the keyboard tooltips feature which is an "opt-in" feature. // UI that depends on this feature should be designed appropriately to prevent clutter. // That's why this switch is set to true by default for all versions of the framework. LocalAppContext.DefineSwitchDefault(AccessibilityImprovements.UseLegacyToolTipDisplaySwitchName, true); break; } } }
private static void InitializeNetFxSwitchDefaultsForNetCoreRuntime() { LocalAppContext.DefineSwitchDefault(CoreAppContextSwitches.DoNotScaleForDpiChangesSwitchName, false); LocalAppContext.DefineSwitchDefault(CoreAppContextSwitches.OverrideExceptionWithNullReferenceExceptionName, false); LocalAppContext.DefineSwitchDefault(CoreAppContextSwitches.DoNotUsePresentationDpiCapabilityTier2OrGreaterSwitchName, false); LocalAppContext.DefineSwitchDefault(CoreAppContextSwitches.DisableStylusAndTouchSupportSwitchName, false); LocalAppContext.DefineSwitchDefault(CoreAppContextSwitches.EnablePointerSupportSwitchName, false); LocalAppContext.DefineSwitchDefault(CoreAppContextSwitches.DisableDiagnosticsSwitchName, false); LocalAppContext.DefineSwitchDefault(CoreAppContextSwitches.AllowChangesDuringVisualTreeChangedSwitchName, false); LocalAppContext.DefineSwitchDefault(CoreAppContextSwitches.DisableImplicitTouchKeyboardInvocationSwitchName, false); LocalAppContext.DefineSwitchDefault(CoreAppContextSwitches.ShouldRenderEvenWhenNoDisplayDevicesAreAvailableSwitchName, false); LocalAppContext.DefineSwitchDefault(CoreAppContextSwitches.ShouldNotRenderInNonInteractiveWindowStationSwitchName, false); LocalAppContext.DefineSwitchDefault(CoreAppContextSwitches.DoNotUsePresentationDpiCapabilityTier3OrGreaterSwitchName, false); LocalAppContext.DefineSwitchDefault(CoreAppContextSwitches.AllowExternalProcessToBlockAccessToTemporaryFilesSwitchName, false); }
private static void InitializeNetFxSwitchDefaultsForNetCoreRuntime() { LocalAppContext.DefineSwitchDefault(FrameworkAppContextSwitches.DoNotApplyLayoutRoundingToMarginsAndBorderThicknessSwitchName, false); LocalAppContext.DefineSwitchDefault(FrameworkAppContextSwitches.GridStarDefinitionsCanExceedAvailableSpaceSwitchName, false); LocalAppContext.DefineSwitchDefault(FrameworkAppContextSwitches.SelectionPropertiesCanLagBehindSelectionChangedEventSwitchName, false); LocalAppContext.DefineSwitchDefault(FrameworkAppContextSwitches.DoNotUseFollowParentWhenBindingToADODataRelationSwitchName, false); LocalAppContext.DefineSwitchDefault(FrameworkAppContextSwitches.IListIndexerHidesCustomIndexerSwitchName, false); LocalAppContext.DefineSwitchDefault(FrameworkAppContextSwitches.AppendLocalAssemblyVersionForSourceUriSwitchName, false); LocalAppContext.DefineSwitchDefault(FrameworkAppContextSwitches.KeyboardNavigationFromHyperlinkInItemsControlIsNotRelativeToFocusedElementSwitchName, false); LocalAppContext.DefineSwitchDefault(FrameworkAppContextSwitches.ItemAutomationPeerKeepsItsItemAliveSwitchName, false); // UseAdornerForTextboxSelectionRenderingSwitchName is always true, i.e., disabled by default. // Do not initialized this again - this was initialized earlier in PopulateDefaultValuesPartial unconditionally. // LocalAppContext.DefineSwitchDefault(FrameworkAppContextSwitches.UseAdornerForTextboxSelectionRenderingSwitchName, true); }
static partial void PopulateDefaultValuesPartial(string platformIdentifier, string profile, int targetFrameworkVersion) { switch (platformIdentifier) { case ".NETFramework": { // Apps targetting .NET Framework version <= 4.6.1 will have to opt-in to Per Monitor DPI Changes using // this switch in app.config. if (targetFrameworkVersion <= 40601) { LocalAppContext.DefineSwitchDefault(CoreAppContextSwitches.DoNotScaleForDpiChangesSwitchName, true); } break; } } }
static partial void PopulateDefaultValuesPartial(string platformIdentifier, string profile, int version) { switch (platformIdentifier) { case ".NETCore": case ".NETFramework": { // All previous versions of that platform (up-to 4.6.2) will get the old behavior by default if (version <= 40602) { LocalAppContext.DefineSwitchDefault("Switch.System.ServiceModel.Internals.IncludeNullExceptionMessageInETWTrace", true); } break; } } }
static partial void PopulateDefaultValuesPartial(string platformIdentifier, string profile, int targetFrameworkVersion) { // The AppContext analyzer expects an if statement here, we should have named the switch 'DoNotUseAdorner' and not included this line at all - by default, switches get set to 'false' // Because this was realized after we shipped, we are going to disable the warning for this switch. #pragma warning disable BCL0012 // The standard behavior is to draw Text/PasswordBox selections via the Adorner. // We want this to always be the case unless it is explicitly changed, regardless of .NET target version. LocalAppContext.DefineSwitchDefault(FrameworkAppContextSwitches.UseAdornerForTextboxSelectionRenderingSwitchName, true); #pragma warning restore BCL0012 switch (platformIdentifier) { case ".NETFramework": { if (targetFrameworkVersion <= 40502) { LocalAppContext.DefineSwitchDefault(FrameworkAppContextSwitches.DoNotApplyLayoutRoundingToMarginsAndBorderThicknessSwitchName, true); } if (targetFrameworkVersion <= 40602) { LocalAppContext.DefineSwitchDefault(FrameworkAppContextSwitches.GridStarDefinitionsCanExceedAvailableSpaceSwitchName, true); } if (targetFrameworkVersion <= 40700) { LocalAppContext.DefineSwitchDefault(FrameworkAppContextSwitches.SelectionPropertiesCanLagBehindSelectionChangedEventSwitchName, true); } if (targetFrameworkVersion <= 40701) { LocalAppContext.DefineSwitchDefault(FrameworkAppContextSwitches.DoNotUseFollowParentWhenBindingToADODataRelationSwitchName, true); } if (40000 <= targetFrameworkVersion && targetFrameworkVersion <= 40702) { LocalAppContext.DefineSwitchDefault(FrameworkAppContextSwitches.IListIndexerHidesCustomIndexerSwitchName, true); } } break; case ".NETCoreApp": { InitializeNetFxSwitchDefaultsForNetCoreRuntime(); } break; } }
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; }
static partial void PopulateDefaultValuesPartial(string platformIdentifier, string profile, int version) { // When defining a new switch you should add it to the last known version. // For instance, if you are adding a switch in .NET 4.6 (the release after 4.5.2) you should defined your switch // like this: // if (version <= 40502) ... // This ensures that all previous versions of that platform (up-to 4.5.2) will get the old behavior by default // NOTE: When adding a default value for a switch please make sure that the default value is added to ALL of the existing platforms! // NOTE: When adding a new if statement for the version please ensure that ALL previous switches are enabled (ie. don't use else if) switch (platformIdentifier) { case ".NETCore": case ".NETFramework": { if (version <= 40502) { LocalAppContext.DefineSwitchDefault("Switch.System.Xml.DontThrowOnInvalidSurrogatePairs", true); LocalAppContext.DefineSwitchDefault("Switch.System.Xml.IgnoreEmptyKeySequences", true); } if (version <= 40601) { LocalAppContext.DefineSwitchDefault("Switch.System.Xml.IgnoreKindInUtcTimeSerialization", true); } break; } case "WindowsPhone": case "WindowsPhoneApp": { if (version <= 80100) { LocalAppContext.DefineSwitchDefault("Switch.System.Xml.DontThrowOnInvalidSurrogatePairs", true); LocalAppContext.DefineSwitchDefault("Switch.System.Xml.IgnoreEmptyKeySequences", true); LocalAppContext.DefineSwitchDefault("Switch.System.Xml.IgnoreKindInUtcTimeSerialization", true); } break; } } }