Obviously the real error is
System.IO.FileNotFoundException
which occurs when a file cannot be found. Look into your code, maybe you're loading a setting from a file that no longer exists and attempt using
System.IO.File.Exists()
function to detect if that file exists before performing the action and of course if you're just going to create a new file, check that the directory where the file would reside has already been created, and again you can use
System.IO.Directory.Exists()
function.
using System.IO;
if (!Directory.Exists("C:\\My Settings Folder")
{
Directory.CreateDirectory("C:\\My Settings Folder");
}
if (File.Exists("C:\\My Settings Folder\\My Settings.xml")
{
}