locked
GetNavigationState doesn't support serialization of a parameter type which was passed to Frame.Navigate

    Question

  • I am using WinRT and Prism for Surface App. getting this exception at the time of suspension.GetNavigationState doesn't support serialization of a parameter type which was passed to Frame.Navigate
    Wednesday, May 28, 2014 7:25 AM

Answers

  • Hi,

    You can refer to the links below:

    http://msdn.microsoft.com/en-us/library/windows/apps/hh702394.aspx

    See remarks:

    To enable frame state serialization using GetNavigationState, you must use only basic types for the navigation parameter, such as string, char, numeric, and GUID types. Otherwise GetNavigationState will throw an exception when the app suspends. The parameter can have other types if you do not use GetNavigationState.If you pass an object as a parameter, an entry in the frame's navigation stack holds a reference on the object until the frame is released or that entry is released upon a new navigation that diverges from the stack. In general, we discourage passing a non-basic type as a parameter to Navigate because it can’t be serialized when the application is suspended, and can consume more memory because a reference is held by the frame’s navigation stack to allow the application to go forward and back. 

    Best Wishes!


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey. Thanks<br/> MSDN Community Support<br/> <br/> Please remember to &quot;Mark as Answer&quot; the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.


    Thursday, May 29, 2014 2:56 AM

All replies

  • You should only pass basic types like strings, ints etc

    Microsoft Certified Solutions Developer - Windows Store Apps Using C#

    Wednesday, May 28, 2014 8:56 AM
  • Hi,

    You can refer to the links below:

    http://msdn.microsoft.com/en-us/library/windows/apps/hh702394.aspx

    See remarks:

    To enable frame state serialization using GetNavigationState, you must use only basic types for the navigation parameter, such as string, char, numeric, and GUID types. Otherwise GetNavigationState will throw an exception when the app suspends. The parameter can have other types if you do not use GetNavigationState.If you pass an object as a parameter, an entry in the frame's navigation stack holds a reference on the object until the frame is released or that entry is released upon a new navigation that diverges from the stack. In general, we discourage passing a non-basic type as a parameter to Navigate because it can’t be serialized when the application is suspended, and can consume more memory because a reference is held by the frame’s navigation stack to allow the application to go forward and back. 

    Best Wishes!


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey. Thanks<br/> MSDN Community Support<br/> <br/> Please remember to &quot;Mark as Answer&quot; the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.


    Thursday, May 29, 2014 2:56 AM