Don't close my stream!

Comments

2 comments

  • Avatar
    Admin

    Hello,

    Which EF Framework version are you using and what .NET version ? When Flush was retired a few versions ago, the writer stream is never closed. You can see here, in the following example:

    using (var stream = new MemoryStream())
    {
    using (var writer = new X12Writer(stream))
    {
    // 3. Begin with ISA segment
    writer.Write(SegmentBuilders.BuildIsa("1"));
    // 4. Follow up with GS segment
    writer.Write(SegmentBuilders.BuildGs("1"));
    // 5. Then write the invoice(s)
    writer.Write(invoice);
    }

    Debug.Write(stream.LoadToString());
    }

    This line:

    Debug.Write(stream.LoadToString());

     

    is executed after the writer was disposed and the stream is still open.

  • Avatar
    Matthew Watkins

    I'm running on .NET 4.6.2 using (as of today) EF 9.7.7. But before today we were using EF 7.3.1. So maybe that's why we had that Flush there. If you don't close the stream for me, that's perfect. Thanks!

Please sign in to leave a comment.