DebugSettings 類別
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
宣告應用程式在特定層面在偵錯環境中執行時的行為
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
- 繼承
- 屬性
範例
此範例顯示 OnLaunched 覆寫,可存取 Application.DebugSettings 並將單一 DebugSettings 值的兩個屬性設定為 true
。 此程式代碼的內容是 app.xaml 程式代碼後置,因此 this
參考應用程式的已建立 Application 物件。
protected override void OnLaunched(LaunchActivatedEventArgs args) {
this.DebugSettings.EnableFrameRateCounter = true;
this.DebugSettings.IsOverdrawHeatMapEnabled = true;
//...
}
備註
無法建構這個類別。 從 Application.DebugSettings 取得值,然後視需要變更屬性。
OnLaunched 是變更 DebugSettings 值的好位置。
並非所有由DebugSettings啟用的模式都需要附加調試程式。 例如,與 EnableFrameRateCounter 相關聯的幀速率計數器會出現在以該設定執行的應用程式中,即使您在沒有調試程序的情況下將其啟用為磚也一樣。
請勿在生產程式代碼中明確設定任何 DebugSettings 屬性。
屬性
EnableFrameRateCounter |
取得或設定值,這個值表示是否要顯示幀速率和每一畫面的CPU使用量資訊。 當應用程式執行時,這些計數器會顯示為視窗 Chrome 中的計數器重疊。 |
FailFastOnErrors |
取得或設定值,這個值表示 XAML 錯誤是否造成立即 FailFast,而不是傳回錯誤。 |
IsBindingTracingEnabled |
取得或設定值,指出應用程式執行時是否要與 Microsoft Visual Studio 的系結追蹤功能互動。 發生參與和系結錯誤時, |
IsTextPerformanceVisualizationEnabled |
取得或設定值,指出應用程式執行時是否要參與 Microsoft Visual Studio 的文字效能視覺效果功能。 |
IsXamlResourceReferenceTracingEnabled |
取得或設定值,指出應用程式執行時是否要與 Microsoft Visual Studio 的 XAML 資源參考追蹤功能互動。 發生參與和 XAML 資源參考錯誤時, |
LayoutCycleDebugBreakLevel |
取得或設定值,這個值表示觸發調試程序斷點的配置循環追蹤事件層級。 |
LayoutCycleTracingLevel |
取得或設定值,這個值表示配置循環追蹤是否寫入原生調試程式,以及所記錄的詳細數據層級。 |
事件
BindingFailed |
發生於無法解析系 結 時。 |
XamlResourceReferenceFailed |
發生於無法解析 XAML 資源的參考時。 |