Skip to content

Allow FileLifecycleHooks to change the length of the stream #186

Closed
@augustoproiete

Description

@augustoproiete

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:


  • Calling SetLength with fileSizeLimitBytes to null throws System.IO.IOException: Unable to truncate data that previously existed in a file opened in Append mode

  • Calling SetLength with fileSizeLimitBytes to any number throws System.NotSupportedException: Specified method is not supported

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions