Share via


DebugSettings Class

Definition

Declares how certain aspects of the app behave when it is run in a debug environment

public ref class DebugSettings sealed
/// [Windows.Foundation.Metadata.ContractVersion(Microsoft.UI.Xaml.WinUIContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
class DebugSettings final
[Windows.Foundation.Metadata.ContractVersion(typeof(Microsoft.UI.Xaml.WinUIContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
public sealed class DebugSettings
Public NotInheritable Class DebugSettings
Inheritance
Object Platform::Object IInspectable DebugSettings
Attributes

Examples

This example shows an OnLaunched override that accesses Application.DebugSettings and sets two properties of the singleton DebugSettings value to true. The context of this code is the app.xaml code-behind, so this refers to the created Application object for the app.

protected override void OnLaunched(LaunchActivatedEventArgs args) {
    this.DebugSettings.EnableFrameRateCounter = true;
    this.DebugSettings.IsOverdrawHeatMapEnabled = true;
    //...
}

Remarks

This class can't be constructed. Get the value from Application.DebugSettings and then change the properties as necessary.

OnLaunched is a good place to change DebugSettings values.

Not all modes enabled by DebugSettings require that a debugger is attached. For example, the frame-rate counter associated with EnableFrameRateCounter will appear in an app that runs with that setting even if you activate it as a tile without the debugger.

Don't leave any DebugSettings properties explicitly set in your production code.

Properties

EnableFrameRateCounter

Gets or sets a value that indicates whether to display frame-rate and per-frame CPU usage info. These display as an overlay of counters in the window chrome while the app runs.

FailFastOnErrors

Gets or sets a value that indicates whether XAML errors cause an immediate FailFast rather than returning an error.

IsBindingTracingEnabled

Gets or sets a value that indicates whether to engage the binding tracing feature of Microsoft Visual Studio when the app runs. When engaged and a binding error occurs, the BindingFailed event is raised and error information is logged in the native debug output.

IsTextPerformanceVisualizationEnabled

Gets or sets a value that indicates whether to engage the text performance visualization feature of Microsoft Visual Studio when the app runs.

IsXamlResourceReferenceTracingEnabled

Gets or sets a value that indicates whether to engage the XAML resource reference tracing feature of Microsoft Visual Studio when the app runs. When engaged and a XAML resource reference error occurs, the XamlResourceReferenceFailed event is raised and error information is logged in the native debug output.

LayoutCycleDebugBreakLevel

Gets or sets a value that indicates the level of layout cycle tracing events that trigger a debugger breakpoint.

LayoutCycleTracingLevel

Gets or sets a value that indicates whether layout cycle tracing is written to the native debugger and the level of detail that is recorded.

Events

BindingFailed

Occurs when a Binding cannot be resolved.

XamlResourceReferenceFailed

Occurs when a reference to a XAML resource cannot be resolved.

Applies to

See also