2012-02-29 11 views
0

My Appは既にApp Hubに公開されています。しかし、私は、GuideAlreadyVisibleExceptionに起因するクラッシュがあるというエラーレポートを受け取りました。 ガイドを使ってカスタムメッセージを表示しました。この例外とは何時ですか?私はデバイスのクラッシュを再現することができません。Stack Trace、GuideAlreadyVisibleException

これは私がメッセージボックス、入力ボックス、またはガイドが表示されることがあり、他のプロンプトが開いているとき、この問題が発生する可能性があり、案内メッセージ

  if (pCycMan.GetStartDate() == pCycMan.GetDefaultDate()) 
      { 
       Guide.BeginShowMessageBox(resMan.GetString("msgboxWelcomeStringHeader"), resMan.GetString("msgboxWelcomeStringDescription1") + "\n" + resMan.GetString("msgboxWelcomeStringDescription2"), 
        new string[] { resMan.GetString("msgBoxWelcomeOk"), resMan.GetString("appBarIconFAQText") }, 1, MessageBoxIcon.None, new AsyncCallback(OnMessageBoxClosed), null); 
      } 
      else if (pCycMan.GetCycleStartDelay() > 0) 
      { 
       if (pCycMan.IsCyclePaused()) 
       { 
        Guide.BeginShowMessageBox(resMan.GetString("msgboxCycleDelayPromptHeader"), resMan.GetString("msgboxCyclePausedPromptDescription") + "\n" + resMan.GetString("msgboxCycleDelayPromptDescription3"), 
         new string[] { resMan.GetString("msgBoxWelcomeOk"), resMan.GetString("appBarIconFAQText") }, 1, MessageBoxIcon.None, new AsyncCallback(OnMessageBoxClosed), null); 
       } 
       else 
       { 
        String delayMsg = resMan.GetString("msgboxCycleDelayPromptDescription1") + " " + pCycMan.GetCycleStartDelay().ToString() + " " + resMan.GetString("msgboxCycleDelayPromptDescription2")+ "\n" + resMan.GetString("msgboxCycleDelayPromptDescription3") ; 

        Guide.BeginShowMessageBox(resMan.GetString("msgboxCycleDelayPromptHeader"), delayMsg, 
         new string[] { resMan.GetString("msgBoxWelcomeOk"), resMan.GetString("appBarIconFAQText") }, 1, MessageBoxIcon.None, new AsyncCallback(OnMessageBoxClosed), null); 
       } 
      } 

そして

 private void OnMessageBoxClosed(IAsyncResult msgboxresult) 
    { 
     int? buttonIndex = Guide.EndShowMessageBox(msgboxresult); 
     switch (buttonIndex) 
     { 
      case 0: 
       break; 

      case 1: 
       Deployment.Current.Dispatcher.BeginInvoke(() => NavigateToHelpPage()); 
       break; 
     } 
    } 
+0

例外のスタックトレースはありますか? –

+0

@MattLacey StackTrace-フレーム画像機能、 COREDLL.DLL xxx_RaiseException、 mscoree3_7.dll WatsonUnhandledManagedException、 mscoree3_7.dll Dbg_NotifyManagedException、 mscoree3_7.dll FirstPassException、 TransitionStub、 Microsoft.Xna.Framework.GamerServices.Guide.BeginShowMessageBox、 Microsoft.Xna.Framework.GamerServices.Guide.BeginShowMessageBox、 LoveCycles_Free.MainPage.HistoryDe​​lClick、 System.Windows.Controls.Primitives.ButtonBase.OnClick、 System.Windows.Controls.Button.OnClick、 System.Windows.Controls。 Primitives.ButtonBase.OnMouseLeftButtonUp、 – alfah

+0

System.Windows.Controls.Control.OnMous eLeftButtonUp、 S.Internal.JoltHelper.FireEvent、 mscoree3_7.dll IL_CallManaged、 mscoree3_7.dll IL_CallDelegateInternal、 mscoree3_7.dll makeComPlusCall、 mscoree3_7.dll makeComPlusCallReturnInt、 CCoreServices :: CLR_FireEvent、 CControlBase ::何ScriptCallback、 これはすべて意味します:O – alfah

答えて

1

を使用している方法です、別のプロンプトが開こうとしているときに表示されているか、またはまだ閉じています。

2つの可能性のある例は、ユーザーがボタンをクリックした後にメッセージボックスを表示する場合です。プロンプトが表示される前にユーザーがボタンを2回クリックするか、最初のプロンプトが完全に閉じる前にユーザーがボタンを再度クリックすると、例外がスローされます。

プロンプトを表示する前に、ヘルパメソッドの呼び出しを追加することによって、この問題を個人的にアプリで回避します。私はヘルパーメソッドと同様の機能を実行するスニペットを含んでいます。私はまた、それが必要な場合にアプリがクラッシュするようにした後、3秒間だけ実行させることで無限ループを回避するためのチェックを追加します(しかしうまくいけばそれはありません)。

public static void GuideSafetyWait(int maxDuration) 
{ 
    DateTime timeStarted = DateTime.Now; 
    while (Guide.IsVisible) 
    { 
     if ((DateTime.Now - timeStarted).TotalMilliseconds >= maxDuration) 
      break; // Prevent infinite loop. 

     Thread.Sleep(10); // This could be any number of milliseconds, but 
          // if its too high, it may deliver a poor user experience. 
    } 
}