17

少なくとも、未処理の例外については、詳細を把握してファイルに書き込み、その後の「デバッグフォレンジック」に使用できるようにしたいと思います。Windowsストアアプリには「OnTerifying」イベントはありません。そのようなことを達成するための適切な場所/方法はありますか?

アップデート

以下の私のコメントを参照してください。以下に収まらない追加があります:

xamlスニペットを削除しても、エラーメッセージが表示されます。また、クリーニングと再構築を行った後でも... ??? 2-err msgをクリックすると、App.xamlの先頭に移動します。その全体が次のようになります。

<Application
    x:Class="SpaceOverlays.App"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:SpaceOverlays">

    <Application.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>

                <!-- 
                    Styles that define common aspects of the platform look and feel
                    Required by Visual Studio project and item templates
                 -->
                <ResourceDictionary Source="Common/StandardStyles.xaml"/>
            </ResourceDictionary.MergedDictionaries>

        </ResourceDictionary>
    </Application.Resources>

更新2

App.xamlを閉じて再構築した後、すべてが順調です... ??? ああ、まあ-すべてが順調に終わります、私は推測します。

更新3

WindowsPhoneアプリApp.xaml.csにデフォルトでこのハンドラーがあるのは興味深いことです。

    // Global handler for uncaught exceptions.
    UnhandledException += Application_UnhandledException;

private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e)
{
    if (Debugger.IsAttached)
    {
        // An unhandled exception has occurred; break into the debugger
        Debugger.Break();
    }
}
4

1 に答える 1

8

HTML5 / JavaScriptアプリの場合、情報を取得する最後のチャンスとして onerrorイベントがあります。

XAMLベースのアプリの場合、UnhandledExceptionを使用できます。ただし、これはXAML(UI)フレームワークを介して発生する例外のみをキャプチャし、InnerExceptionであっても、根本的な原因について多くの情報を常に取得できるとは限りません。

Windows 8.1の更新: UnhandledExceptionasync voidは、メソッドによって作成された例外もキャプチャします。Windows 8では、このような例外はアプリをクラッシュさせるだけです。LunarFrogは彼らのウェブサイトでこれについて良い議論をしています。

于 2012-12-02T03:55:40.700 に答える