Windows Phone - "Session state service failed"

Oct 2, 2014 at 6:42 AM
Hi,

In testing the "Suspend" on my Windows Phone I get this message "Session state service failed":
-       e   {Windows.UI.Xaml.UnhandledExceptionEventArgs}   Windows.UI.Xaml.UnhandledExceptionEventArgs
-       Exception   {Microsoft.Practices.Prism.Mvvm.SessionStateServiceException: Session state service failed ---> System.ArgumentNullException: Value cannot be null.
Parameter name: key
   at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
   at System.Collections.Generic.Dictionary`2.set_Item(TKey key, TValue value)
   at Microsoft.Practices.Prism.StoreApps.VisualStateAwarePage.OnNavigatedFrom(NavigationEventArgs e)
   at Windows.UI.Xaml.Controls.Frame.GetNavigationState()
   at Microsoft.Practices.Prism.Mvvm.FrameFacadeAdapter.GetNavigationState()
   at Microsoft.Practices.Prism.Mvvm.SessionStateService.SaveFrameNavigationState(IFrameFacade frame)
   at Microsoft.Practices.Prism.Mvvm.SessionStateService.<SaveAsync>d__0.MoveNext()
   --- End of inner exception stack trace ---
   at Microsoft.Practices.Prism.Mvvm.SessionStateService.<SaveAsync>d__0.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
   at Microsoft.Practices.Prism.Mvvm.MvvmAppBase.<OnSuspending>d__d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.<ThrowAsync>b__3(Object state)
   at System.Threading.WinRTSynchronizationContext.Invoker.InvokeCore()}    System.Exception {Microsoft.Practices.Prism.Mvvm.SessionStateServiceException}
+       [Microsoft.Practices.Prism.Mvvm.SessionStateServiceException]   {Microsoft.Practices.Prism.Mvvm.SessionStateServiceException: Session state service failed ---> System.ArgumentNullException: Value cannot be null.
Parameter name: key
   at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
   at System.Collections.Generic.Dictionary`2.set_Item(TKey key, TValue value)
   at Microsoft.Practices.Prism.StoreApps.VisualStateAwarePage.OnNavigatedFrom(NavigationEventArgs e)
   at Windows.UI.Xaml.Controls.Frame.GetNavigationState()
   at Microsoft.Practices.Prism.Mvvm.FrameFacadeAdapter.GetNavigationState()
   at Microsoft.Practices.Prism.Mvvm.SessionStateService.SaveFrameNavigationState(IFrameFacade frame)
   at Microsoft.Practices.Prism.Mvvm.SessionStateService.<SaveAsync>d__0.MoveNext()
   --- End of inner exception stack trace ---
   at Microsoft.Practices.Prism.Mvvm.SessionStateService.<SaveAsync>d__0.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
   at Microsoft.Practices.Prism.Mvvm.MvvmAppBase.<OnSuspending>d__d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.<ThrowAsync>b__3(Object state)
   at System.Threading.WinRTSynchronizationContext.Invoker.InvokeCore()}    Microsoft.Practices.Prism.Mvvm.SessionStateServiceException
+       Data    {System.Collections.ListDictionaryInternal} System.Collections.IDictionary {System.Collections.ListDictionaryInternal}
        HelpLink    null    string
        HResult -2146233088 int
-       InnerException  {System.ArgumentNullException: Value cannot be null.
Parameter name: key
   at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
   at System.Collections.Generic.Dictionary`2.set_Item(TKey key, TValue value)
   at Microsoft.Practices.Prism.StoreApps.VisualStateAwarePage.OnNavigatedFrom(NavigationEventArgs e)
   at Windows.UI.Xaml.Controls.Frame.GetNavigationState()
   at Microsoft.Practices.Prism.Mvvm.FrameFacadeAdapter.GetNavigationState()
   at Microsoft.Practices.Prism.Mvvm.SessionStateService.SaveFrameNavigationState(IFrameFacade frame)
   at Microsoft.Practices.Prism.Mvvm.SessionStateService.<SaveAsync>d__0.MoveNext()}    System.Exception {System.ArgumentNullException}
+       [System.ArgumentNullException]  {System.ArgumentNullException: Value cannot be null.
Parameter name: key
   at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
   at System.Collections.Generic.Dictionary`2.set_Item(TKey key, TValue value)
   at Microsoft.Practices.Prism.StoreApps.VisualStateAwarePage.OnNavigatedFrom(NavigationEventArgs e)
   at Windows.UI.Xaml.Controls.Frame.GetNavigationState()
   at Microsoft.Practices.Prism.Mvvm.FrameFacadeAdapter.GetNavigationState()
   at Microsoft.Practices.Prism.Mvvm.SessionStateService.SaveFrameNavigationState(IFrameFacade frame)
   at Microsoft.Practices.Prism.Mvvm.SessionStateService.<SaveAsync>d__0.MoveNext()}    System.ArgumentNullException
+       Data    {System.Collections.ListDictionaryInternal} System.Collections.IDictionary {System.Collections.ListDictionaryInternal}
        HelpLink    null    string
        HResult -2147467261 int
+       InnerException  null    System.Exception
        Message "Value cannot be null.\r\nParameter name: key"  string
        Source  "mscorlib"  string
        StackTrace  "   at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)\r\n   at System.Collections.Generic.Dictionary`2.set_Item(TKey key, TValue value)\r\n   at Microsoft.Practices.Prism.StoreApps.VisualStateAwarePage.OnNavigatedFrom(NavigationEventArgs e)\r\n   at Windows.UI.Xaml.Controls.Frame.GetNavigationState()\r\n   at Microsoft.Practices.Prism.Mvvm.FrameFacadeAdapter.GetNavigationState()\r\n   at Microsoft.Practices.Prism.Mvvm.SessionStateService.SaveFrameNavigationState(IFrameFacade frame)\r\n   at Microsoft.Practices.Prism.Mvvm.SessionStateService.<SaveAsync>d__0.MoveNext()" string
+       Static members      
+       Non-Public members      
        Message "Session state service failed"  string
        Source  "Microsoft.Practices.Prism.StoreApps"   string
        StackTrace  "   at Microsoft.Practices.Prism.Mvvm.SessionStateService.<SaveAsync>d__0.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.GetResult()\r\n   at Microsoft.Practices.Prism.Mvvm.MvvmAppBase.<OnSuspending>d__d.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.<ThrowAsync>b__3(Object state)\r\n   at System.Threading.WinRTSynchronizationContext.Invoker.InvokeCore()"   string
+       Static members      
+       Non-Public members      
        Handled false   bool
        Message "Session state service failed"  string
If you want I can zip my project and send it to you, but I don't want to make it available on my OneDrive.
Dec 26, 2014 at 4:40 AM
Are you overriding OnNavigatedTo in your views?
Dec 31, 2014 at 9:59 PM
Edited Dec 31, 2014 at 9:59 PM
Hi, Yes.
Jan 1, 2015 at 9:09 AM
make sure you call the base.OnNavigatedTo method if you override it in your view implementation.
Jan 5, 2015 at 4:48 AM
Ok, thanks and will get back with you if anything comes up!...
Jan 5, 2015 at 8:59 PM
I had the same error and calling the base method in my OnNavigatedTo override fixed it. As a side note, you can usually avoid implementing OnNavigated/From in the views and instead move this code to the ViewModels.
Aug 15, 2015 at 1:38 AM
I have a similar problem when in using Prism winRT I Suspend the app from the VS2013 toolbar and receive an exception in closing "Session state service failed".
Is P&P reviewing such items?