in src/Serilog.Sinks.AzureDataExplorer/Durable/LogShipper.cs [322:341]
static bool FileIsUnlockedAndUnextended(FileSetPosition position)
{
try
{
using (var fileStream = IOFile.Open(position.File, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.Read))
{
return fileStream.Length <= position.NextLineStart;
}
}
catch (IOException)
{
// Where no HRESULT is available, assume IOExceptions indicate a locked file
}
catch (Exception ex)
{
SelfLog.WriteLine("Unexpected exception while testing locked status of {0}: {1}", position.File, ex);
}
return false;
}