I want to configure the restoration of the application from the point from which the application was terminated by the system, but an error occurs, I have a two-page application, if on the main page I’ve played the system’s application stop, then everything is fine, but with the second page there is an error

enter image description here

I do a training video, in their example everything is fine, in my analogy there is no https://mva.microsoft.com/ru/training-courses/-windows-10-15867?l=wg7YwPv7B_205192797 17:11 time

part of the code where the error occurs

private void OnSuspending(object sender, SuspendingEventArgs e) { var deferral = e.SuspendingOperation.GetDeferral(); //TODO: Сохранить состояние приложения и остановить все фоновые операции Frame frame = Window.Current.Content as Frame; *ApplicationData.Current.LocalSettings.Values["NavigationState"] = frame.GetNavigationState();* deferral.Complete(); } 

1 answer 1

https://social.msdn.microsoft.com/Forums/windowsapps/en-US/ad753362-0d52-42b3-8917-b2897033ba49/getnavigationstate-doesnt-support-serialization-of-a-parameter-type-which-was- passed-to? forum = winappswithcsharp & forum = winappswithcsharp

To enable frame state serialization using GetNavigationState , you must pass only the base types for this method, such as string, char, numeric, and GUID types. If you pass an object as a parameter, an entry in the navigation frame of the frame contains an object reference until the frame is released or this entry is released with a new navigation that diverges from the stack. In general, we prevent the transfer of a non-base type as a parameter for navigation, because it cannot be serialized when the application is suspended, and can consume more memory, because the link is stored in the frame's navigation stack to allow the application to go forward and backward .

https://stackoverflow.com/questions/23896488/getnavigationstate-doesnt-support-serialization-of-a-parameter-type-which-was-p