private void FlushCurrentFileWrites(string currentFileName, LogEventInfo firstLogEvent, MemoryStream ms,
List<AsyncContinuation> pendingContinuations)
{
Exception lastException = null;
try
{
if (currentFileName != null)
ProcessLogEvent(firstLogEvent, currentFileName, ms.ToArray());
}
catch (Exception exception)
{
if (exception.MustBeRethrown())
{
throw;
}
lastException = exception;
}
foreach (AsyncContinuation cont in pendingContinuations)
{
cont(lastException);
}
pendingContinuations.Clear();
}