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
--> Update: use Stream and leaveopen in the signature, mark this constructor as obsolete
--> for back compat leave dispose in close, but support leaveOpen for external stream.
To Reproduce
use ext.StreamWriter, try to reuse Streamwriter after encoding, need to create a new StreamWriter, but disposed object cannot be reused.
Expected behavior
external Streamwriter is not disposed, only internal.
Code snippets
m_writer.Dispose();// only dispose if streamwriter is owned by JSONEncoder.m_writer=null;returnlength;
Environment (please complete the following information):
OS: any
Development environment: Visual Studio 2019
Runtime: .NET Core 3.1
Component: JSONEncoder, Core
The text was updated successfully, but these errors were encountered:
mregen
changed the title
JSONEncoder should not dispose external Streamwriter on close
JSONEncoder should use Stream, support leaveOpen on close
Jul 8, 2021
- only dispose StreamWriter if owned by JsonEncoder
- only dispose if dispose is called
- on external stream writer, return text by using reflection on basestream, if memorystream is used
- improve benchmark common code
- fixes#1444
Type of Issue
Describe the Issue
Constructor allows external StreamWriter to use:
, but the Streamwriter is disposed in Close.
--> Update: use Stream and leaveopen in the signature, mark this constructor as obsolete
--> for back compat leave dispose in close, but support leaveOpen for external stream.
To Reproduce
use ext.StreamWriter, try to reuse Streamwriter after encoding, need to create a new StreamWriter, but disposed object cannot be reused.
Expected behavior
external Streamwriter is not disposed, only internal.
Code snippets
Environment (please complete the following information):
The text was updated successfully, but these errors were encountered: