Я пытаюсь загрузить INI-файл с IniConfigurationProvider следующим образом (используя net core 3.1)
var config = @"D:\config.ini";
Console.WriteLine(File.Exists(config)); //true
var configProvider = new IniConfigurationProvider(
new IniConfigurationSource() {
Path = config
}
);
configProvider.Load();
, но выдает FileNotFoundException
Unhandled exception. System.IO.FileNotFoundException: The configuration file 'D:\config.ini' was not found and is not optional.
at Microsoft.Extensions.Configuration.FileConfigurationProvider.Load(Boolean reload)
at Microsoft.Extensions.Configuration.FileConfigurationProvider.Load()
at MyProgram.Program.ThreadProc() in d:\apps\Program.cs:line 39
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location where exception was thrown ---
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
File.Exists
prints true
, так почему же тогда проходит исключение?