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
Description
Trying to use LZ4EncoderStream to compress and decompress but when using it we are getting below exception
System.Net.Http.HttpRequestException : Error while copying content to a stream.
----> System.IO.IOException : No message provided
----> System.InvalidOperationException : Synchronous operations are disallowed. Call WriteAsync or set AllowSynchronousIO to true.
To reproduce
Calling this method context.HttpContext.Response.Body.WriteAsync(byteArray, 0, byteArray.Length);
and it is using LZ4Stream.Encode(stream, null, leaveOpen: true); method to do the job but it is failing with above exception.
I have analysed the LZ4EncoderStream.cs class and it is trying to use DisposeAsync() method and inside that it is using _writer.Dispose() insteady of _writer.DisposeAsync() hence it is complaining that Synchronous operations are disallowed.
Pleas see below code
public override ValueTask DisposeAsync()
{
_writer.Dispose();
return base.DisposeAsync();
}
Line no 59 in LZ4EncoderStream.cs class
Expected behavior
Expected compression to work when using WriteAsync() method
Actual behavior
Throw below exception
System.Net.Http.HttpRequestException : Error while copying content to a stream.
----> System.IO.IOException : No message provided
----> System.InvalidOperationException : Synchronous operations are disallowed. Call WriteAsync or set AllowSynchronousIO to true.
Environment
CPU: _ [Intel 64 bit]
OS: _ [Windows]
.NET: _ [6]
LZ4: _ [1.3.5]
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered:
Description
Trying to use LZ4EncoderStream to compress and decompress but when using it we are getting below exception
System.Net.Http.HttpRequestException : Error while copying content to a stream.
----> System.IO.IOException : No message provided
----> System.InvalidOperationException : Synchronous operations are disallowed. Call WriteAsync or set AllowSynchronousIO to true.
To reproduce
Calling this method context.HttpContext.Response.Body.WriteAsync(byteArray, 0, byteArray.Length);
and it is using LZ4Stream.Encode(stream, null, leaveOpen: true); method to do the job but it is failing with above exception.
I have analysed the LZ4EncoderStream.cs class and it is trying to use DisposeAsync() method and inside that it is using _writer.Dispose() insteady of _writer.DisposeAsync() hence it is complaining that Synchronous operations are disallowed.
Pleas see below code
Expected behavior
Expected compression to work when using WriteAsync() method
Actual behavior
Throw below exception
System.Net.Http.HttpRequestException : Error while copying content to a stream.
----> System.IO.IOException : No message provided
----> System.InvalidOperationException : Synchronous operations are disallowed. Call WriteAsync or set AllowSynchronousIO to true.
Environment
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: