I am completely stumped on this one, I have a static class attempting to detect if a directory exists, but for some reason, it throws the following error:
Program.Main encountered an error: Object reference not set to an instance of an object. Stack trace: at csv.prepareCSVData() in path/csv.cs:line 21
at RLCSVTools.Program.Main(String[] args) in path\Program.cs:line 31
This is the code that produces that error in csv.cs.prepareCSVData
:
ConfigurationSync.logDebugMessage(logMessageType.warning, "CSV class Dir: " + exportPath);
//this log works and reveals exportPath has been populated
if (Directory.Exists(exportPath) == false)
//breaks here regardless of dir existing or not
{
ConfigurationSync.logDebugMessage(logMessageType.warning, "Recreating the directory: " + exportPath);
// I have never seen this log run
Directory.CreateDirectory(exportPath);
}
I have added some comments in the code to show at exactly what line the error occurs.
All members of this class, including the class, are static. public static class csv
Has anyone experienced anything like this? I can't seem to find a solution.