gpt4 book ai didi

c# - GetNavigationState 不支持传递给 Frame.Navigate 的参数类型的序列化

转载 作者:可可西里 更新时间:2023-11-01 09:24:29 26 4
gpt4 key购买 nike

我正在为 Surface 应用程序使用 WinRT 和 Prism。暂停时出现此异常。GetNavigationState 不支持传递给 Frame.Navigate 的参数类型的序列化 enter image description here

最佳答案

很可能您在某处将复杂类型传递给 Navigate(),并且该类型无法序列化。

路易斯·坎特罗 (Luis Cantero) 的回答 here :

To enable serialization of the frame's state using GetNavigationState, you must pass only basic types to this method, such as string, char, numeric, and GUID types. 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.

另见 Exception when calling SuspensionManager.SaveAsync()

http://www.damirscorner.com/UsingSuspensionManagerForSavingApplicationState.aspx

关于c# - GetNavigationState 不支持传递给 Frame.Navigate 的参数类型的序列化,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23896488/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com