dotnet / dotnet/dotnet-api-docs

ZipArchive constructor remarks are incorrect for current .NET Framework and .NET Core

Open
#1,128 1 comment 0 reactions 0 assignees View on GitHub
area-System.IO.Compression Pri3 untriaged
Dominant language
C#
Stars
949
Forks
1.7k
Avg merge
3d 27m
Merged PRs (30d)
49

Description

In the current documentation for ZipArchive's constructor, it states:

> If the mode parameter is set to Read, the stream must support reading. If the mode parameter is set to Create, the stream must support writing. If the mode parameter is set to Update, the stream must support reading, writing, and seeking.

This is not correct in current versions of both .NET Core and .NET Framework due to a bug:
https://github.com/dotnet/corefx/issues/11497

The provided stream, if the mode is set to Create, must support writing and be able to get position information. Though most write-only streams do not support querying for position, you can create a stream subclass that tracks position to work around the issue, as described here:
https://stackoverflow.com/questions/16585488/writing-to-ziparchive-using-the-httpcontext-outputstream

Could the documentation be updated to explain how the class currently works? An example of the required wrapper class would also be helpful.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.