Template10 设置服务异常

Template10 SettingsService exception

使用 Template10 1.18,在 VisualStudio 中暂停 App 时(使用生命周期事件),我看到 "the size of the state manager setting value has exceeded the limit"。如下面的堆栈跟踪所示,直接涉及 Template10.Services.SettingsService.SettingsService.Write。我知道一个答案是不使用设置服务,并在挂起时为数据写入文件,但是 Template10 正在处理这个所以最好让它。 如果我必须关闭 Template10 设置服务,怎么办?或者我可以覆盖该方法并避免使用 LocalSettings 吗?

NMA-Client.McgInterop.dll!System.Runtime.InteropServices.WindowsRuntime.IMapSharedReferenceTypesStubClass.Insert(System.Collections.Generic.IDictionary _this, string key, object value) Line 2176 C# NMA-Client.McgInterop.dll!Windows.Storage.ApplicationDataCompositeValue.System.Collections.Generic.IDictionary.set_Item(string index, object value) Line 9704 C# Template10Library.dll!Template10.Services.SettingsService.SettingsService.Write(string key, string value) Unknown Template10Library.dll!Template10.Services.NavigationService.NavigationService.SaveNavigationAsync() Unknown Template10Library.dll!Template10.Services.NavigationService.NavigationService.SaveNavigationAsync() Unknown Template10Library.dll!Template10.Services.NavigationService.NavigationService.SuspendingAsync() Unknown Template10Library.dll!Template10.Services.NavigationService.NavigationService.SuspendingAsync() Unknown Template10Library.dll!Template10.Common.BootStrapper.HandleSuspending() Unknown Template10Library.dll!Template10.Common.BootStrapper.HandleSuspending.AnonymousMethod__2() Unknown Template10Library.dll!Template10.Common.DispatcherWrapper.DispatchAsync() Unknown Template10Library.dll!Template10.Common.DispatcherWrapper.DispatchAsync(System.Func func, int delayms, Windows.UI.Core.CoreDispatcherPriority priority) Unknown Template10Library.dll!Template10.Common.BootStrapper.HandleSuspending() Unknown Template10Library.dll!Template10.Common.BootStrapper.HandleSuspending(object sender, Windows.ApplicationModel.SuspendingEventArgs e) Unknown System.Private.SharedLibrary.Interop.Generated.dll!Windows.Foundation.AsyncOperationProgressHandler.Invoke(Windows.Foundation.IAsyncOperationWithProgress asyncInfo, uint progressInfo) C# NMA-Client.McgInterop.dll!McgInterop.ReverseComSharedStubs.Proc_object__TArg0__(object __this, System.Runtime.InteropServices.__vtable_IInspectable* unsafe_sender, void* unsafe_e, System.IntPtr __methodPtr) Line 9745 C# NMA-Client.McgInterop.dll!Windows.UI.Xaml.SuspendingEventHandler__Impl.Vtbl.Invoke__STUB(System.IntPtr pComThis, System.Runtime.InteropServices.__vtable_IInspectable* unsafe_sender, Windows.ApplicationModel.ISuspendingEventArgs__Impl.Vtbl** unsafe_e) Line 94537 C#

模板 10 SettingServiceSettingHelper 的通用包装器,适用于 90% 的开发人员。看来您的应用需要特殊实施。您可以将现有的 SettingsService 复制到您的项目中来解决您的问题。我意识到 SettingService 不适用于 10% 的应用程序。你是幸运的 10% 之一。但是您的自定义包装器应该可以解决这个问题。

在此处获取源代码https://github.com/Windows-XAML/Template10/blob/master/Template10%20(Library)/Services/SettingsService/SettingsService.cs