Closed DifferentLevelDan closed 10 months ago
System.IO.IOException: 'The process cannot access the file 'C:\Users\Diffe\AppData\Roaming\Pulsar4X\Pulsar4X\preferences.ini' because it is being used by another process.'
` if(!File.Exists(preferencesPath)) { File.Create(preferencesPath); }
IConfiguration preferences = new ConfigurationBuilder().AddIniFile(preferencesPath).Build();`
Exception is on the IConfiguration preferences = new ConfigurationBuilder().AddIniFile(preferencesPath).Build(); line.
Specifically, File.Create returns a FileStream that is not properly disposed before trying to be accessed by the ConfigurationBuilder.
System.IO.IOException: 'The process cannot access the file 'C:\Users\Diffe\AppData\Roaming\Pulsar4X\Pulsar4X\preferences.ini' because it is being used by another process.'
` if(!File.Exists(preferencesPath)) { File.Create(preferencesPath); }
Exception is on the IConfiguration preferences = new ConfigurationBuilder().AddIniFile(preferencesPath).Build(); line.
Specifically, File.Create returns a FileStream that is not properly disposed before trying to be accessed by the ConfigurationBuilder.