Skip to content

Crash when project lies at network location | Failed to save settings: An error occurred loading a configuration file #112410

Closed as duplicate of#109846
@Rsge

Description

@Rsge

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

  1. Create an application (e.g. WinForms) using .NET 9. at a network location (Network drive or UNC path)
  2. Create the settings by adding any setting, e.g. a String Test with value "X".
  3. Change this setting in the running program using My.Settings.Test = "Y" or Properties.Settings.Default.Test = "Y";, respectively.
  4. Save using My.Settings.Save() / Properties.Settings.Default.Save();
  5. Run the program.

TestC#VB.zip

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions