Prism Service Status Session Error (Windows Store App)

I am trying to react to pause events in my Windows Store app. I added the appropriate callback method, but I got the problem:

App.Current.Suspending += Current_Suspending;

void Current_Suspending(object sender, Windows.ApplicationModel.SuspendingEventArgs e){}

      

The problem is that when I fire a suspend event in Visual Studio and the callback method is called (I checked it with a breakpoint), it ends immediately with an Exception:

Session state session failed.

Any suggestions on how to solve this problem?

+3


source to share


1 answer


If you are using Prism like me this can happen when the SessionStateService chokes while serializing the object. The corresponding navigation options and anything manually added are serialized when the application ends or pauses. In my specific case, I had a null enum that was not set on the object being used as a navigation parameter. I used the following to check that the DataContractSerializer has no problem with the object.



test.Add("testitem", new WorkflowStep());
MemoryStream sessionData = new MemoryStream();
DataContractSerializer serializer = new DataContractSerializer(typeof(Dictionary<string, object>));
serializer.WriteObject(sessionData, test);

      

0


source







All Articles