2012-01-17 29 views
3

私のアプリからクラッシュレポートを受け取りました。私は本当に問題が何かを理解していない。それは決して 私とクラッシュ...何が問題になることができますか?アプリのハブエラーメッセージから:BackgroundAgentが存在しないIsolatedStorageSettings.ApplicationSettingsからアイテムをロードしようとしているようアプリがクラッシュします。 KeyException?

0 coredll.dll xxx_RaiseException 19
1 mscoree3_7.dll 436488
2 mscoree3_7.dll 386545
3 mscoree3_7.dll 540936
4 TransitionStub 0
5 System.ThrowHelper.ThrowKeyNotFoundException 52
6 System.Collections.Generic.Dictionary 2.get_Item 136
7 System.IO.IsolatedStorage.IsolatedStorageSettings.get_Item 80
8 ScheduledTaskAgent1.ScheduledAgent.OnInvoke 660
9 Microsoft.Phone.Scheduler.ScheduledTaskAgent.Invoke 856
10 .AgentRequest.Invoke 764
11 Microsoft.Phone.BackgroundAgentDispatcher.InvocationThread 196
12 System.Threading.ThreadHelper.ThreadStartHelper 132
13 System.Threading.ThreadHelper.ThreadStart_Context 80
14 System.Threading.ExecutionContext.Run 324
15 System.Threading.ThreadHelper.ThreadStartHelper 168
16 mscoree3_7.dll 429164
17 mscoree3_7.dll 310125
18 mscoree3_7.dll 310319
19 mscoree3_7.dll 305995"

答えて

8

見えます。 ScheduledTaskAgent1.ScheduledAgent.OnInvokeメソッドをチェックインします。

1 /まずあなたがいる場合、たとえば、それに応じて

作用し、それが

2 /キーが存在しない場合は取得する前に、「IsolatedStorageSettings.ApplicationSettings.Contains」メソッドを使用してキーの有無を確認します

「設定」はエラーメッセージも参照しているキーです。コードを次のように置き換えます。

if (IsolatedStorageSettings.ApplicationSettings.Contains("setting")) 
{ 
    somevalue = IsolatedStorageSettings.ApplicationSettings["setting"]; 
}else 
{ 
    // set somevalue to its default value 
} 
関連する問題