【问题标题】:Debugging WP7 Crash调试 WP7 崩溃
【发布时间】:2011-08-11 19:08:40
【问题描述】:

我第一次尝试 WP7 的 Stack traces。

这给我带来了特别的麻烦,并且从我的应用程序的几个用户中弹出。我需要一些帮助来破译这个。

这是堆栈轨道:

Frame    Image                 Function                                                                              Offset    
0        coredll.dll           xxx_RaiseException                                                                32        
1        mscoree3_7.dll    WatsonUnhandledManagedException                                                   300       
2        mscoree3_7.dll    Dbg_NotifyManagedException                                                        136       
3        mscoree3_7.dll    FirstPassException                                                                1044      
4                          TransitionStub                                                                    0         
5                          System.ThrowHelper.ThrowArgumentException                                         52        
6                          System.Collections.Generic.Dictionary`2.Insert                                    344       
7                          System.IO.IsolatedStorage.IsolatedStorageSettings.Add                             92        
8                          traffic_and_travel_uk.Services.push_settings.button4_Click                        92        
9                          System.Windows.Controls.Primitives.ButtonBase.OnClick                             132       
10                         System.Windows.Controls.Button.OnClick                                            120       
11                         System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUp                 228       
12                         System.Windows.Controls.Control.OnMouseLeftButtonUp                               100       
13                         MS.Internal.JoltHelper.FireEvent                                                  800       
14       mscoree3_7.dll    IL_CallManaged                                                                    860       
15       mscoree3_7.dll    IL_CallDelegateInternal                                                           176       
16       mscoree3_7.dll    makeComPlusCall                                                                   984       
17       mscoree3_7.dll    makeComPlusCallReturnInt                                                          40        
   18                                                                                                           0         
19       agcore.dll        CCoreServices::CLR_FireEvent                                                      400       
20       npctrl.dll        CommonBrowserHost::CLR_FireEvent                                                  36        
21       npctrl.dll        CControlBase::ScriptCallback                                                      536       
22       npctrl.dll        CXcpDispatcher::OnScriptCallback                                                  300       
23       npctrl.dll        CXcpDispatcher::OnReentrancyProtectedWindowMessage                                712       
  24       npctrl.dll        CXcpDispatcher::WindowProc                                                        408       
25       coredll.dll       SendMessageW                                                                      96        
26       npctrl.dll        CXcpBrowserHost::SyncScriptCallbackRequest                                        196       
27       agcore.dll        CEventManager::RaiseControlEvents                                                 208       
28       agcore.dll        CEventManager::Raise                                                              320       
29       agcore.dll        CEventManager::RaiseInterleavedRoutedEvents                                       360       
30       agcore.dll        CInputManager::InterleaveMouseAndGesture                                          320       
31       agcore.dll        CInputManager::ProcessMouseInput                                                  1768      
32       agcore.dll        CInputManager::SimulateMouse                                                      248       
33       agcore.dll        CInputManager::ProcessGestureInput                                                4492      
34       agcore.dll        CInputManager::ProcessInput                                                       440       
35       agcore.dll        CCoreServices::ProcessInput                                                       68        
36       npctrl.dll        CXcpBrowserHost::HandleInputMessage                                               920       
37       npctrl.dll        CXcpControl::OnGestureEvent                                                       460       
38       npctrl.dll        CXcpControl::ProcessWindowMessage                                                 1868      
39       npctrl.dll        ATL::CWindowImplBaseT_ATL::CWindow,ATL::CWinTraits_1442840576,0_ _::WindowProc    140       
40       coredll.dll       DispatchMessageW   
41       TaskHost.exe      CHostActiveXModule::RunMessageLoop                                                424       
 42       TaskHost.exe      ATL::CAtlExeModuleT_CHostActiveXModule_::Run                                      40        
43       TaskHost.exe      WinMain                                                                           1420      
44       TaskHost.exe      WinMainCRTStartupHelper                                                           60        
45       coredll.dll       MainThreadBaseFunc                                                                428

所以我可以看到它卡在 button4_Click 功能上并添加了 Iso 存储设置,但这里还发生了什么?我无法理解导致某些人崩溃的原因。

这是有问题的代码:

private void button4_Click(object sender, RoutedEventArgs e)
    {
        var settings = IsolatedStorageSettings.ApplicationSettings;
        settings.Add("FirstPush", "true");

        var hide = Visibility.Collapsed;
        grid4.Visibility = hide;
        SE_service_btn_Click1();
    }

谢谢。任何指导表示赞赏。

【问题讨论】:

    标签: c# .net windows-phone-7 crash stack-trace


    【解决方案1】:

    查看documentationIsolatedStorageSettings.Add()

    ArgumentException   key already exists in the dictionary.
    

    请改用IsolatedStorageSettings["FirstPush"] = "true"。这将创建或更新密钥,如果它已经存在而不抛出异常。

    【讨论】:

    • 非常感谢,我想这可能是它。除了堆栈中 IsoStorage 行上方的异常之外,还有什么告诉您该异常是由 IsoStorage 引起的?
    • 好吧,该方法的文档明确指出,如果密钥已经存在并且您在写入之前没有检查密钥是否存在,它会抛出该异常。我猜您的应用程序在第二次按下该按钮时始终崩溃并出现相同的异常:-)
    猜你喜欢
    • 2010-12-07
    • 1970-01-01
    • 1970-01-01
    • 2017-06-10
    • 2021-10-01
    • 2023-03-03
    • 2020-02-15
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多