Skip to content

Unable to access closed stream #1822

@kendallb

Description

@kendallb

Describe the bug
We did not have this issue with v106, but since moving to v107 we are now having issues when trying to read from the response stream into a file where we get an error saying you cannot read from a closed stream. So I suspect that somehow the response stream is being closed before we have finished reading from it? The request is set up like this:

                    var request = new RestRequest {
                        ResponseWriter = responseStream => {
                            var buffer = new byte[81920];
                            int count;
                            while ((count = responseStream.Read(buffer, 0, buffer.Length)) != 0) {
                                stream.Write(buffer, 0, count);
                            }
                            return responseStream;
                        },
                    };
                    request.Resource = resource;
                    request.Method = Method.Get;
                    return request;

Is there perhaps a different way we should be reading the response stream with v107?

Desktop (please complete the following information):

  • Windows Server 2016
  • .NET Framework
  • Version 4.8

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions