You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Asynchronous ZipArchive stream methods still call synchronous methods of the underlying stream:
using (var zip = new ZipArchive(/new WriteOnlyStreamWrapper(/httpContext.Response.Body/)/, ZipArchiveMode.Create))
await using (Stream strm = zip.CreateEntry("response").Open())
{
await strm.WriteAsync(bytes); // Synchronous operations are disallowed exception here
}
If I debug using my wrapper, I can see that Flush is called on the stream instead of FlushAsync
Reproduction Steps
Write some code that creates a ZipArchive for writing around a stream that supports only asynchronous operations, creates an entry, open it and write some data to the stream asynchronously.
Expected behavior
The data has been successfully written
Actual behavior
Get "Synchronous operations are disallowed" exception because the framework calls a synchronous method (Flush)
Regression?
No response
Known Workarounds
No response
Configuration
.Net 8, Windows, x64
Other information
No response
The text was updated successfully, but these errors were encountered:
Tagging subscribers to this area: @dotnet/area-system-io-compression
See info in area-owners.md if you want to be subscribed.
ericstj
added
needs-further-triage
Issue has been initially triaged, but needs deeper consideration or reconsideration
and removed
untriaged
New issue has not been triaged by the area owner
labels
Sep 4, 2024
Description
Asynchronous ZipArchive stream methods still call synchronous methods of the underlying stream:
using (var zip = new ZipArchive(/new WriteOnlyStreamWrapper(/httpContext.Response.Body/)/, ZipArchiveMode.Create))
await using (Stream strm = zip.CreateEntry("response").Open())
{
await strm.WriteAsync(bytes); // Synchronous operations are disallowed exception here
}
If I debug using my wrapper, I can see that Flush is called on the stream instead of FlushAsync
Reproduction Steps
Write some code that creates a ZipArchive for writing around a stream that supports only asynchronous operations, creates an entry, open it and write some data to the stream asynchronously.
Expected behavior
The data has been successfully written
Actual behavior
Get "Synchronous operations are disallowed" exception because the framework calls a synchronous method (Flush)
Regression?
No response
Known Workarounds
No response
Configuration
.Net 8, Windows, x64
Other information
No response
The text was updated successfully, but these errors were encountered: