The following code block is falling into the catch, and the zip file does NOT exist already, I check for that in the code block prior to this code block.
try
{
ZipFile.CreateFromDirectory(pathToFilesToZip, zipPath, CompressionLevel.Fastest, true);
//ZipFile.ExtractToDirectory(zipPath, pathToStoreNewZipFile);
return true;
}
catch (Exception ex)
{
//log error here
var errorMessage = ex.InnerException;
Console.WriteLine(errorMessage);
return false;
}
The issue is the code worked, the zip file was created in its proper location. Even stranger, ex is null in the catch block. Why is an executed code line generating an exception?