Closed as duplicate of#109846
Description
Description
When trying to save changed settings from a project on a network location (network drive or UNC path) in .NET 9 using My.Settings.Save()
or Properties.Settings.Default.Save();
, respectively, a program crash occurs.
Reproduction Steps
- Create an application (e.g. WinForms) using .NET 9. at a network location (Network drive or UNC path)
- Create the settings by adding any setting, e.g. a String
Test
with value"X"
. - Change this setting in the running program using
My.Settings.Test = "Y"
orProperties.Settings.Default.Test = "Y";
, respectively. - Save using
My.Settings.Save()
/Properties.Settings.Default.Save();
- Run the program.
Expected behavior
The program saving the settings to the default save location, as it did in .NET 8. No crash, obviously.
Actual behavior
The program crashes with the following error:
System.Configuration.ConfigurationErrorsException: 'Failed to save settings: An error occurred loading a configuration file: An unexpected error occurred in 'ClientConfigurationHost::OpenStreamForWrite '' '''.'
InvalidOperationException: An unexpected error occurred in 'ClientConfigurationHost::OpenStreamForWrite '' '''.
This exception was originally thrown at this call stack:
[External Code]
Regression?
Worked in .NET 8, 6 and 5 definitively and probably 7, too. Haven't tested .NET FW.
Known Workarounds
Don't put the project at a network location, but save it on a local drive.
Configuration
- .NET SDK:
- Version: 9.0.102
- Commit: cb83cd4923
- Workload version: 9.0.100-manifests.4a54b1a6
- MSBuild version: 17.12.18+ed8c6aec5
- Runtime environment:
- OS Name: Windows
- OS Version: 10.0.19045
- OS Platform: Windows
- RID: win-x64
- Base Path: C:\Program Files\dotnet\sdk\9.0.102\
Haven't tested on other configurations.
Other information
—