-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Open
Labels
Description
Describe the bug
If SaveWindowPosition = true
in the MetroWindow and TargetFramework = net9.0-windows
the application throws an exception on closing and not saving the window position:
ZH.TED.Test.WPF Error: 0 : MahApps.Metro.Behaviors.WindowsSettingBehavior: The settings could not be saved! System.Configuration.ConfigurationErrorsException: Failed to save settings: An error occurred loading a configuration file: An unexpected error occurred in 'ClientConfigurationHost::OpenStreamForWrite '' '''.
---> System.Configuration.ConfigurationErrorsException: An error occurred loading a configuration file: An unexpected error occurred in 'ClientConfigurationHost::OpenStreamForWrite '' '''.
---> System.InvalidOperationException: An unexpected error occurred in 'ClientConfigurationHost::OpenStreamForWrite '' '''.
at System.Configuration.ClientConfigurationHost.OpenStreamForWrite(String streamName, String templateStreamName, Object& writeContext)
at System.Configuration.MgmtConfigurationRecord.SaveAs(String filename, ConfigurationSaveMode saveMode, Boolean forceUpdateAll)
--- End of inner exception stack trace ---
at System.Configuration.MgmtConfigurationRecord.SaveAs(String filename, ConfigurationSaveMode saveMode, Boolean forceUpdateAll)
at System.Configuration.ClientSettingsStore.WriteSettings(String sectionName, Boolean isRoaming, IDictionary newSettings)
--- End of inner exception stack trace ---
at System.Configuration.ClientSettingsStore.WriteSettings(String sectionName, Boolean isRoaming, IDictionary newSettings)
at System.Configuration.LocalFileSettingsProvider.SetPropertyValues(SettingsContext context, SettingsPropertyValueCollection values)
at System.Configuration.SettingsBase.SaveCore()
at System.Configuration.SettingsBase.Save()
at MahApps.Metro.Behaviors.WindowsSettingBehavior.SaveWindowState()
Steps to reproduce
Here is an example project:
ZH.TED.Test.WPF.zip
If you switch to net8.0-windows as TargetFramework, it works as expected.
Environment
MahApps.Metro version: 2.4.10
Target Framework: .Net 9 (9.0.100)