I check for the existence of a file upon application startup; however, the code behaves as if the file is not there.
if (File.Exists("Data/machine.config"))
{
var doc = new XmlDocument();
doc.Load("Data/machine.config");
var machine = doc.SelectSingleNode("/config/SingleAxis | /config/CoreXY | /config/Cartesian");
if (machine != null)
{
builder.Services.AddSingleton<MachineService>();
builder.Services.AddHostedService(provider => provider.GetRequiredService<MachineService>());
builder.Services.AddSingleton<AvaloniaUIService>();
builder.Services.AddHostedService(provider => provider.GetRequiredService<AvaloniaUIService>());
}
}
else
{
Debug.WriteLine("No machine.config file found.");
}
Is there some difference between how the debugger runs the code and how the config app runs the code?