// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

// runtimeconfig.template.json replaces App.Config based AppContext configuration
// The following AppContext based flags are available for use in WPF Apps, and are initialized with 
// Default values as shown below
{
  "configProperties": {
    /*
    // BuildTasksAppContextSwitches

    // The WPF MarkupCompiler provides compilation services for XAML markup files. In the .NET Framework 4.7.1
    // and earlier versions, the default hash algorithm used for checksums was SHA1. Due to recent security
    // concerns with SHA1, this default has been changed to SHA256 starting with the .NET Framework 4.7.2.
    // This change affects all checksum generation for markup files during compilation.
    "Switch.System.Windows.Markup.DoNotUseSha256ForMarkupCompilerChecksumAlgorithm": false,


    // CoreAppContextSwitches

    // Determines whether DPI changes occur on a per-system (a value of false) or per-monitor basis (a value of true).
    "Switch.System.Windows.DoNotScaleForDpiChanges": false,

    // Switch to enable the correct exception being thrown in ImageSourceConverter.ConvertFrom instead of NullReferenceException
    "Switch.System.Windows.Media.ImageSourceConverter.OverrideExceptionWithNullReferenceException": false,

    // When set to true, WPF will not enable the compatibility breaking bug fixes associated with
    // features advertised by ""Switch.System.Windows.PresentationDpiCapabilityTier2""
    // The following behavior would be turned off when this flag is set by the application:
    // - Improvements to how HwndHost sizes child windows in response to DPI changes
    // - Improvements to window placement during startup
    // The following fixes would remain unaffected:
    //  - High-DPI related accessibility fixes.
    "Switch.System.Windows.DoNotUsePresentationDpiCapabilityTier2OrGreater": false,

    // This turns off the entirety of the WPF touch support, leaving WM_POINTER
    // messages to be processed by DefWndProc(), or be handled by the application directly.
    "Switch.System.Windows.Input.Stylus.DisableStylusAndTouchSupport": false,

    // https://docs.microsoft.com/en-us/dotnet/framework/migration-guide/mitigation-pointer-based-touch-and-stylus-support
    // Switch to enable WPF support for the WM_POINTER based stylus/touch stack
    "Switch.System.Windows.Input.Stylus.EnablePointerSupport": false,

    // Switch to disable diagnostic features
    "Switch.System.Windows.Diagnostics.DisableDiagnostics": false,

    // Switch to allow changes during a VisualTreeChanged event
    "Switch.System.Windows.Diagnostics.AllowChangesDuringVisualTreeChanged": false,

    // Switch to disable automatic touch keyboard invocation on focus of a control
    // This flag only works on Windows 10 1607 (RS1; Anniversary Update), Windows 10 1703 (RS2; Creators Update), 
    // and Windows 10 1709 (RS3; Fall Creators Update)
    "Switch.System.Windows.Input.Stylus.DisableImplicitTouchKeyboardInvocation": false,

    // Desktop/Interactive Window Stations:
    //  Rendering will be throttled back/stopped when no display devices are available. For e.g., when a TS 
    //  session is in WTSDisconnected state, the OS may not provide any display devices in response to our enumeration.
    //
    //  If an application would like to continue rendering in the absence of display devices (accepting that 
    //  it can lead to a CPU spike), it can set 
    //  to true.
    //
    // Service/Non-interactive Window Stations
    //  Rendering will continue by default, irrespective of the presence of display devices.Unless the WPF
    //  API's being used are short-lived (like rendering to a bitmap), it can lead to a CPU spike. 
    //  If an application running inside a service would like to receive the 'default' WPF behavior, 
    //  i.e., no rendering in the absence of display devices, then it should set
    //  to true
    //
    // In pseudo-code, 
    //  IsNonInteractiveWindowStation = !Environment.UserInteractive
    //    IF DisplayDevicesNotFound() THEN
    //      IF IsNonInteractiveWindowStation THEN 
    //        // We are inside a SCM service
    //        // Default = True, AppContext switch can override it to False
    //        ShouldRender = !CoreAppContextSwitches.ShouldNotRenderInNonInteractiveWindowStation
    //      ELSE 
    //        // Desktop/interactive mode, including WTSDisconnected scenarios
    //        // Default = False, AppContext switch can override it to True
    //        ShouldRender = CoreAppContextSwitches.ShouldRenderEvenWhenNoDisplayDevicesAreAvailable
    //        END IF
    //      END IF"
    "Switch.System.Windows.Media.ShouldRenderEvenWhenNoDisplayDevicesAreAvailable": false,
    "Switch.System.Windows.Media.ShouldNotRenderInNonInteractiveWindowStation": false,

    // Reserved for future use
    "Switch.System.Windows.DoNotUsePresentationDpiCapabilityTier3OrGreater": false,

    // 
    "Switch.System.Windows.AllowExternalProcessToBlockAccessToTemporaryFiles": false,

    // Malicious managed objects could be placed in the clipboard lying about its format, 
    // to fix this OleConverter now restricts object deserialization in some cases.
    // When this switch is enabled behavior falls back to deserializing without restriction.
    "Switch.System.Windows.EnableLegacyDangerousClipboardDeserializationMode": false,

    // FrameworkAppContextSwitches

    // Switch to enable non-adorner based rendering of TextSelection in TextBox and PasswordBox
    // https://github.com/microsoft/dotnet/blob/main/Documentation/compatibility/wpf-TextBox-PasswordBox-text-selection-does-not-follow-system-colors.md
    "Switch.System.Windows.Controls.Text.UseAdornerForTextboxSelectionRendering": true,

    // https://github.com/microsoft/dotnet/blob/main/Documentation/compatibility/wpf-layout-rounding-of-margins-has-changed.md
    "Switch.MS.Internal.DoNotApplyLayoutRoundingToMarginsAndBorderThickness": false,

    // https://github.com/microsoft/dotnet/blob/main/Documentation/compatibility/wpf-grid-allocation-of-space-to-star-columns.md
    "Switch.System.Windows.Controls.Grid.StarDefinitionsCanExceedAvailableSpace": false,

    // https://github.com/microsoft/dotnet/blob/main/Documentation/compatibility/wpf-tabcontrol-selectionchanged-and-selectedcontent.md
    "Switch.System.Windows.Controls.TabControl.SelectionPropertiesCanLagBehindSelectionChangedEvent": false,

    // https://github.com/microsoft/dotnet/blob/main/Documentation/compatibility/wpf-mainDetail-ADOdata-PrimaryKey.md
    "Switch.System.Windows.Data.DoNotUseFollowParentWhenBindingToADODataRelation": false,

    // Switch to enable IList indexer hiding a custom indexer in a binding path
    "Switch.System.Windows.Data.Binding.IListIndexerHidesCustomIndexer": false,

    // Switch to enable appending the local assembly version to the Uri being set 
    // for ResourceDictionary.Source via Baml2006ReaderInternal.
    "Switch.System.Windows.Baml2006.AppendLocalAssemblyVersionForSourceUri": false,

    // Switch to enable keyboard navigation from a hyperlink to go to the wrong place
    "Switch.System.Windows.Controls.KeyboardNavigationFromHyperlinkInItemsControlIsNotRelativeToFocusedElement": false,

    // Switch to opt-out of the ItemAutomationPeer weak-reference.
    // Setting this to true can avoid NRE crashes, but re-introduces some memory leaks
    "Switch.System.Windows.Automation.Peers.ItemAutomationPeerKeepsItsItemAlive": false,

    // BaseAppContextSwitches

    // Starting .NET 4.6, ExecutionContext tracks Thread.CurrentCulture and Thread.CurrentUICulture, which would be restored
    // to their respective previous values after a call to ExecutionContext.Run. This behavior is undesirable within the
    // Dispatcher - various dispatcher operations can run user code that can in turn set Thread.CurrentCulture or
    // Thread.CurrentUICulture, and we do not want those values to be overwritten with their respective previous values.
    // To work around the new ExecutionContext behavior, we introduce CulturePreservingExecutionContext for use within
    // Dispatcher and DispatcherOperation. WPF in .NET 4.6 & 4.6.1 shipped with buggy behavior - each DispatcherOperation
    // ends with all modifications to culture infos being reverted.Though unlikely, if some applications targeting 4.6 or
    // above might have taken a dependence on this bug, we provide this compatibility switch that can be enabled by the application.
    "Switch.MS.Internal.DoNotUseCulturePreservingDispatcherOperations": false,

     //PacakageDigitalSignatureManager.DefaultHashAlgorithm is now SHA256. Setting this flag will make it SHA1 as it
     //is in legacy scenarios prior to .NET 4.7.1.
    "Switch.MS.Internal.UseSha1AsDefaultHashAlgorithmForDigitalSignatures": false,

    // Allowing developers to turn off the Invoke added by a previous code change, as there are compat issues with
    // timing during shutdown for some applications.
    "Switch.MS.Internal.DoNotInvokeInWeakEventTableShutdownListener": false,

    // Improved the memory allocation and cleanup scheduling behavior of the weak-event pattern
    "Switch.MS.Internal.EnableCleanupSchedulingImprovements": false,

    // Enable/disable various perf and memory improvements related to WeakEvents
    "Switch.MS.Internal.EnableWeakEventMemoryImprovements": false,

    // AccessibilitySwitches
    // https://docs.microsoft.com/en-us/dotnet/framework/whats-new/whats-new-in-accessibility
    // https://github.com/microsoft/dotnet/blob/main/Documentation/compatibility/wpf-accessibility-improvements.MD
    // https://github.com/microsoft/dotnet/blob/main/Documentation/compatibility/wpf-accessibility-improvements-48.md

    "Switch.UseLegacyAccessibilityFeatures": false,
    "Switch.UseLegacyAccessibilityFeatures.2": false,
    "Switch.UseLegacyAccessibilityFeatures.3": false,
    "Switch.UseLegacyToolTipDisplay": false,

    // Guards the fix for the automation tree under a plain ItemsControl
    // https://github.com/microsoft/dotnet/blob/main/releases/net48/dotnet48-changes.md
    "Switch.System.Windows.Controls.ItemsControlDoesNotSupportAutomation": false
  */
  }
}
