Skip to content

OpenApiStreamReader disposes input stream after reading and it's not configurable #530

Closed

Description

Hi all,

I have to use OpenApiStreamReader as a one of the several steps, of handling the Stream. The problem is, that when I read the stream using OpenApiStreamReader.Read(stream) at first, then the Stream is disposed and cannot be used anymore. I cannot configure anyhow to Read the stream without disposing it, as I can do that in the base StreamReader.

Link - bool leaveOpen

Here is my example reproduction:

// openApiSpec is a Stream argument of the method
var openApiStreamReader = new OpenApiStreamReader();
var openApiDocument = openApiStreamReader.Read(openApiSpec, out var openApiDiagnostic);

Activity

  1. darrelmiller commented on Dec 13, 2020

    @darrelmiller
    Member

    This is a good call out. We use StreamReader under the covers with a using statement, hence why dispose is called. I think we can add a property to OpenReaderSettings to allow control of this.

  2. added this to the 1.3 milestone on Dec 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

type:enhancementEnhancement request targeting an existing experience

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions