Reputation: 119
I get crash reports from my app. I really don't understand what the problem is. It never crashes with me... What can be the problem? From the app hub error message:
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"
Upvotes: 3
Views: 264
Reputation: 39007
Looks like the BackgroundAgent is trying to load an item from the IsolatedStorageSettings.ApplicationSettings that doesn't exist. Check in your ScheduledTaskAgent1.ScheduledAgent.OnInvoke method.
1/ First check the existence of the key using the "IsolatedStorageSettings.ApplicationSettings.Contains" method before retrieving it
2/ If the key does not exist, act accordingly
For instance, if you're doing:
somevalue = IsolatedStorageSettings.ApplicationSettings["setting"];
Then "setting" is the key the error message is referring too. Replace your code by:
if (IsolatedStorageSettings.ApplicationSettings.Contains("setting"))
{
somevalue = IsolatedStorageSettings.ApplicationSettings["setting"];
}else
{
// set somevalue to its default value
}
Upvotes: 8