Closed
Description
Currently files are opened with FileMode.Append
, which prevents FileLifecycleHooks
from modifying the size of the stream when implementing an OnFileOpened
hook.
In addition, when fileSizeLimitBytes
is set, the stream is wrapped via WriteCountingStream
which does not implement SetLength
.
Changing the size of the stream can be useful in a few scenarios, such as:
- Creating a new log file every time the app runs (i.e. truncate instead of append)
- Set an initial size to pre-allocate/reserve disk space for the log file (e.g. 1 GB)
-
Calling
SetLength
withfileSizeLimitBytes
tonull
throwsSystem.IO.IOException: Unable to truncate data that previously existed in a file opened in Append mode
-
Calling
SetLength
withfileSizeLimitBytes
to any number throwsSystem.NotSupportedException: Specified method is not supported
Metadata
Metadata
Assignees
Labels
No labels