2

誰かがこの問題に遭遇したかどうかはわかりません。

VS 2012 で C# Windows Phone 8 アプリを開発しています。

最近、System.NotImplementedException 型の未処理の例外が発生しています。

これは、すべてのコードが try/catch ブロックで囲まれており、notimplementedexception をスローするメソッド スタブがないにもかかわらずです。

出力は次のとおりです。

タイプ 'System.NotImplementedException' の初回例外が MyAppName.DLL で発生しました

タイプ 'System.NotImplementedException' の例外が MyAppName.DLL で発生し、マネージド/ネイティブ境界の前に処理されませんでした

「続行」をクリックしてデバッグを続行すると、VS でエラー メッセージのポップアップ ダイアログが表示されます。

System.Windows.ni.dll で「System.NotImplementedException」タイプの未処理の例外が発生しました

ここで [ブレーク] を選択すると、スタック トレースが開き、「利用可能なソースがありません。コール スタックには外部コードのみが含まれます。このスレッドは、コール スタック上の外部コード フレームのみで停止されます。など」と表示されます。

これは、アプリがクラッシュした後に強調表示されたコードです。

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

編集:これはスタックです:

Call stack with external code
System.Windows.ni.dll!MS.Internal.JoltHelper.OnUnhandledException(object sender, System.UnhandledExceptionEventArgs args)
mscorlib.ni.dll!System.Runtime.CompilerServices.AsyncMethodBuilderCore.ThrowAsync.AnonymousMethod_1(object state)
mscorlib.ni.dll!System.Threading.QueueUserWorkItemCallback.WaitCallback_Context(object state)
mscorlib.ni.dll!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx)
mscorlib.ni.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx)
mscorlib.ni.dll!System.Threading.QueueUserWorkItemCallback..System.Threading.|ThreadPoolWorkItem.ExecuteWorkItem()
mscorlib.ni.dll!System.Threading.ThreadPoolWorkQueue.Dispatch()
mscorlib.ni.dll!System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()
[Native to Managed Transition]
4

1 に答える 1

1

同様の問題を抱えている人のために、明らかな原因を見つけました。

Surface 用の Win8 アプリからのファイル入出力に関するコードをいくつか移植しましたが、行の 1 つで、変更を怠っていました。

StorageFolder storageFolder = KnownFolders.DocumentsLibrary;

それに対応する

IsolatedStorageFile storageFolder = IsolatedStorageFile.GetUserStoreForApplication();

これがなぜかtry/catchブロックで引っかからなかったのですが、直したらuncat notimplementedexceptionが発生しなくなりました。

于 2013-01-24T21:55:35.620 に答える