Windows phone 7 堆栈跟踪,GuideAlreadyVisibleException
我的应用已在应用中心发布。但我收到一份错误报告,说有一个由GuideAlreadyVisibleException引起的崩溃。 我使用指南来显示自定义消息。这个例外是什么?它是什么时候引起的?我无法在设备中重现崩溃 这就是我使用指南信息的方式Windows phone 7 堆栈跟踪,GuideAlreadyVisibleException,windows-phone-7,exception,Windows Phone 7,Exception,我的应用已在应用中心发布。但我收到一份错误报告,说有一个由GuideAlreadyVisibleException引起的崩溃。 我使用指南来显示自定义消息。这个例外是什么?它是什么时候引起的?我无法在设备中重现崩溃 这就是我使用指南信息的方式 if (pCycMan.GetStartDate() == pCycMan.GetDefaultDate()) { Guide.BeginShowMessageBox(resM
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);
}
}
及
当向导显示的消息框、输入框或任何其他提示正在打开、可见或在另一个提示尝试打开时仍在关闭时,可能会出现此问题 两个可能的例子是,如果您的应用程序在用户单击按钮后显示消息框。如果用户在显示提示之前快速单击按钮两次,或者在第一个提示完全关闭之前再次单击按钮,则会引发异常 在某些应用程序中,我个人通过在显示任何提示之前添加对助手方法的调用来避免此问题。我包含了一个代码段,它执行的功能与我的helper方法类似。我还添加了一个检查,通过只让它运行3秒钟来避免无限循环,之后如果需要,我会让应用程序崩溃(但希望不会)
您有异常的stacktrace吗?@MattLacey stacktrace-Frame Image函数、coredll.dll xxx\u RaiseException、mscoree3\u 7.dll WatsonUnhandledManagedException、mscoree3\u 7.dll Dbg\u NotifyManagedException、mscoree3\u 7.dll FirstPasseException、TransitionStub、,Microsoft.Xna.Framework.GamerServices.Guide.BeginShowMessageBox,Microsoft.Xna.Framework.GamerServices.Guide.BeginShowMessageBox,LoveCycles\u Free.MainPage.HistoryDelClick,System.Windows.Controls.Primitives.ButtonBase.OnClick,System.Windows.Controls.Button.OnClick,System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUp,System.Windows.Controls.Control.OnMouseLeftButtonUp、S.Internal.Joltelper.FireEvent、mscoree3_7.dll IL_CallManaged、mscoree3_7.dll IL_CallDelegateInternal、mscoree3_7.dll makeComPlusCall、mscoree3_7.dll makeComPlusCallReturnInt、CCoreServices::CLR_FireEvent、CControlBase::ScriptCallback、,这一切意味着什么:将问题添加到stacktrace中可能会使阅读更容易。不管怎样,我首先要向
HistoryDelClick
添加一些异常处理。
private void OnMessageBoxClosed(IAsyncResult msgboxresult)
{
int? buttonIndex = Guide.EndShowMessageBox(msgboxresult);
switch (buttonIndex)
{
case 0:
break;
case 1:
Deployment.Current.Dispatcher.BeginInvoke(() => NavigateToHelpPage());
break;
}
}
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.
}
}