Xcube-Studio / Natsurainko.FluentLauncher

Natsurainko.FluentLauncher A Minecraft launcher designed for Windows 11
https://fluentlauncher.natsurainko.work/
MIT License
304 stars 16 forks source link

[Bug] 主题色加载导致的错误 #196

Closed BelazyFly closed 9 months ago

BelazyFly commented 1 year ago

描述遇到的问题

System.ArgumentException System.ArgumentException: An item with the same key has already been added. at ABI.System.Collections.Generic.IDictionaryMethods2.Add(IObjectReference obj, K key, V value) at Microsoft.UI.Xaml.ResourceDictionary.Add(Object key, Object value) at Natsurainko.FluentLauncher.Services.UI.AppearanceService.ApplyThemeColorBeforePageInit(ShellPage page) at Natsurainko.FluentLauncher.Views.ShellPage..ctor() at Natsurainko.FluentLauncher.Natsurainko_FluentLauncher_XamlTypeInfo.XamlTypeInfoProvider.Activate_250_ShellPage() at Natsurainko.FluentLauncher.Natsurainko_FluentLauncher_XamlTypeInfo.XamlUserType.ActivateInstance() at ABI.Microsoft.UI.Xaml.Markup.IXamlType.Do_Abi_ActivateInstance_13(IntPtr thisPtr, IntPtr* result) --- End of stack trace from previous location --- at WinRT.ExceptionHelpers.<ThrowExceptionForHR>g__Throw|20_0(Int32 hr) at WinRT.ExceptionHelpers.ThrowExceptionForHR(Int32 hr) at ABI.Microsoft.UI.Xaml.Controls.IFrameMethods.Navigate(IObjectReference _obj, Type sourcePageType, Object parameter) at Microsoft.UI.Xaml.Controls.Frame.Navigate(Type sourcePageType, Object parameter) at Natsurainko.FluentLauncher.Services.UI.Navigation.NavigationService.NavigateTo(String key, Object parameter) at Natsurainko.FluentLauncher.Views.MainWindow.WindowEx_Activated(Object sender, WindowActivatedEventArgs args) at WinRT._EventSource_global__Windows_Foundation_TypedEventHandler_object__global__Microsoft_UI_Xaml_WindowActivatedEventArgs_.EventState.<GetEventInvoke>b__1_0(Object sender, WindowActivatedEventArgs args) at ABI.Windows.Foundation.TypedEventHandler2.Do_Abi_Invoke[TSenderAbi,TResultAbi](Void* thisPtr, TSenderAbi sender, TResultAbi args)

复现问题的步骤

System.ArgumentException System.ArgumentException: An item with the same key has already been added. at ABI.System.Collections.Generic.IDictionaryMethods2.Add(IObjectReference obj, K key, V value) at Microsoft.UI.Xaml.ResourceDictionary.Add(Object key, Object value) at Natsurainko.FluentLauncher.Services.UI.AppearanceService.ApplyThemeColorBeforePageInit(ShellPage page) at Natsurainko.FluentLauncher.Views.ShellPage..ctor() at Natsurainko.FluentLauncher.Natsurainko_FluentLauncher_XamlTypeInfo.XamlTypeInfoProvider.Activate_250_ShellPage() at Natsurainko.FluentLauncher.Natsurainko_FluentLauncher_XamlTypeInfo.XamlUserType.ActivateInstance() at ABI.Microsoft.UI.Xaml.Markup.IXamlType.Do_Abi_ActivateInstance_13(IntPtr thisPtr, IntPtr* result) --- End of stack trace from previous location --- at WinRT.ExceptionHelpers.<ThrowExceptionForHR>g__Throw|20_0(Int32 hr) at WinRT.ExceptionHelpers.ThrowExceptionForHR(Int32 hr) at ABI.Microsoft.UI.Xaml.Controls.IFrameMethods.Navigate(IObjectReference _obj, Type sourcePageType, Object parameter) at Microsoft.UI.Xaml.Controls.Frame.Navigate(Type sourcePageType, Object parameter) at Natsurainko.FluentLauncher.Services.UI.Navigation.NavigationService.NavigateTo(String key, Object parameter) at Natsurainko.FluentLauncher.Views.MainWindow.WindowEx_Activated(Object sender, WindowActivatedEventArgs args) at WinRT._EventSource_global__Windows_Foundation_TypedEventHandler_object__global__Microsoft_UI_Xaml_WindowActivatedEventArgs_.EventState.<GetEventInvoke>b__1_0(Object sender, WindowActivatedEventArgs args) at ABI.Windows.Foundation.TypedEventHandler2.Do_Abi_Invoke[TSenderAbi,TResultAbi](Void* thisPtr, TSenderAbi sender, TResultAbi args)

期望的表现

System.ArgumentException System.ArgumentException: An item with the same key has already been added. at ABI.System.Collections.Generic.IDictionaryMethods2.Add(IObjectReference obj, K key, V value) at Microsoft.UI.Xaml.ResourceDictionary.Add(Object key, Object value) at Natsurainko.FluentLauncher.Services.UI.AppearanceService.ApplyThemeColorBeforePageInit(ShellPage page) at Natsurainko.FluentLauncher.Views.ShellPage..ctor() at Natsurainko.FluentLauncher.Natsurainko_FluentLauncher_XamlTypeInfo.XamlTypeInfoProvider.Activate_250_ShellPage() at Natsurainko.FluentLauncher.Natsurainko_FluentLauncher_XamlTypeInfo.XamlUserType.ActivateInstance() at ABI.Microsoft.UI.Xaml.Markup.IXamlType.Do_Abi_ActivateInstance_13(IntPtr thisPtr, IntPtr* result) --- End of stack trace from previous location --- at WinRT.ExceptionHelpers.<ThrowExceptionForHR>g__Throw|20_0(Int32 hr) at WinRT.ExceptionHelpers.ThrowExceptionForHR(Int32 hr) at ABI.Microsoft.UI.Xaml.Controls.IFrameMethods.Navigate(IObjectReference _obj, Type sourcePageType, Object parameter) at Microsoft.UI.Xaml.Controls.Frame.Navigate(Type sourcePageType, Object parameter) at Natsurainko.FluentLauncher.Services.UI.Navigation.NavigationService.NavigateTo(String key, Object parameter) at Natsurainko.FluentLauncher.Views.MainWindow.WindowEx_Activated(Object sender, WindowActivatedEventArgs args) at WinRT._EventSource_global__Windows_Foundation_TypedEventHandler_object__global__Microsoft_UI_Xaml_WindowActivatedEventArgs_.EventState.<GetEventInvoke>b__1_0(Object sender, WindowActivatedEventArgs args) at ABI.Windows.Foundation.TypedEventHandler2.Do_Abi_Invoke[TSenderAbi,TResultAbi](Void* thisPtr, TSenderAbi sender, TResultAbi args)

环境

22631.2506 23H2 Windows 11 专业版

在微软商店下载的应该是现在所知最新版

附件

System.ArgumentException System.ArgumentException: An item with the same key has already been added. at ABI.System.Collections.Generic.IDictionaryMethods2.Add(IObjectReference obj, K key, V value) at Microsoft.UI.Xaml.ResourceDictionary.Add(Object key, Object value) at Natsurainko.FluentLauncher.Services.UI.AppearanceService.ApplyThemeColorBeforePageInit(ShellPage page) at Natsurainko.FluentLauncher.Views.ShellPage..ctor() at Natsurainko.FluentLauncher.Natsurainko_FluentLauncher_XamlTypeInfo.XamlTypeInfoProvider.Activate_250_ShellPage() at Natsurainko.FluentLauncher.Natsurainko_FluentLauncher_XamlTypeInfo.XamlUserType.ActivateInstance() at ABI.Microsoft.UI.Xaml.Markup.IXamlType.Do_Abi_ActivateInstance_13(IntPtr thisPtr, IntPtr* result) --- End of stack trace from previous location --- at WinRT.ExceptionHelpers.<ThrowExceptionForHR>g__Throw|20_0(Int32 hr) at WinRT.ExceptionHelpers.ThrowExceptionForHR(Int32 hr) at ABI.Microsoft.UI.Xaml.Controls.IFrameMethods.Navigate(IObjectReference _obj, Type sourcePageType, Object parameter) at Microsoft.UI.Xaml.Controls.Frame.Navigate(Type sourcePageType, Object parameter) at Natsurainko.FluentLauncher.Services.UI.Navigation.NavigationService.NavigateTo(String key, Object parameter) at Natsurainko.FluentLauncher.Views.MainWindow.WindowEx_Activated(Object sender, WindowActivatedEventArgs args) at WinRT._EventSource_global__Windows_Foundation_TypedEventHandler_object__global__Microsoft_UI_Xaml_WindowActivatedEventArgs_.EventState.<GetEventInvoke>b__1_0(Object sender, WindowActivatedEventArgs args) at ABI.Windows.Foundation.TypedEventHandler2.Do_Abi_Invoke[TSenderAbi,TResultAbi](Void* thisPtr, TSenderAbi sender, TResultAbi args)

natsurainko commented 9 months ago

在 2.2.6.0 中修复