Is it posiible that the following code doesn’t throw any exception and doesn’t copy files?
void Copy2(string from, string to)
{
lock (_thisLock)
{
if (File.Exists(from))
{
File.Copy(from, to, true);
return;
}
Logger.Write("File does not exists");
}
}
Customer says that the application doesn’t crash and doesn’t copy any file, and doesn’t write log.
Logger’s type is Microsoft.Practices.EnterpriseLibrary.Logging.Logger.
Sure, if the file doesn’t exist –
(!File.Exists)– then theFile.Copycall won’t get reached.Logger.Writedoes not count as an exception.If, as your update suggests, there is nothing in the logs, I would double check the
Logger.Writefunction. Is it implemented correctly? Is there an exception being thrown and handled within that method? That would be more likely thanFile.Copyfailing without throwing an exception.