DebugSettings 類別

定義

宣告應用程式在偵錯環境中執行時,應用程式的某些層面行為

public ref class DebugSettings sealed
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
class DebugSettings final
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
class DebugSettings final
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
public sealed class DebugSettings
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
public sealed class DebugSettings
Public NotInheritable Class DebugSettings
繼承
Object Platform::Object IInspectable DebugSettings
屬性

Windows 需求

裝置系列
Windows 10 (已於 10.0.10240.0 引進)
API contract
Windows.Foundation.UniversalApiContract (已於 v1.0 引進)

範例

此範例顯示 OnLaunched 覆寫,可存取 Application.DebugSettings ,並將單一 DebugSettings 值的兩個屬性設定為 true。 此程式碼的內容是 app.xaml 程式碼後置,因此 是指應用程式的已建立 Application 物件。

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

備註

無法建構這個類別。 從 Application.DebugSettings 取得值,然後視需要變更屬性。

OnLaunched 是變更 DebugSettings 值的好位置。

並非 DebugSettings 啟用的所有模式都需要附加偵錯工具。 例如,與 EnableFrameRateCounter 相關聯的畫面播放速率計數器會出現在以該設定執行的應用程式中,即使您在沒有偵錯工具的情況下將其啟用為磚也一樣。

請勿在生產程式碼中明確設定任何 DebugSettings 屬性。

版本歷程記錄

Windows 版本 SDK 版本 新增值
1809 17763 FailFastOnErrors

屬性

EnableFrameRateCounter

取得或設定值,這個值表示是否要顯示畫面播放速率和每一畫面的 CPU 使用量資訊。 這些計數器會在應用程式執行時顯示為視窗 Chrome 中的計數器重迭。

EnableRedrawRegions

取得或設定值,這個值表示是否要反白顯示要重新繪製每個畫面的應用程式 UI 介面區域。

FailFastOnErrors

取得或設定值,這個值表示 XAML 錯誤是否造成立即的 FailFast,而不是傳回錯誤。

IsBindingTracingEnabled

取得或設定值,這個值表示應用程式執行時是否要與 Microsoft Visual Studio 的系結追蹤功能互動。

IsOverdrawHeatMapEnabled

取得或設定值,這個值會啟用視覺化過度繪製作業的偵錯設定。 此視覺效果在應用程式開發期間很有用,可偵測大量圖形處理的版面配置、動畫和其他作業。

IsTextPerformanceVisualizationEnabled

取得或設定值,這個值表示應用程式執行時是否要參與 Microsoft Visual Studio 的文字效能視覺效果功能。

事件

BindingFailed

無法解析 系結 時發生。

適用於

另請參閱