Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JsonWriter doesn't flush on Dispose/Close #35

Open
GoogleCodeExporter opened this issue Apr 5, 2015 · 2 comments
Open

JsonWriter doesn't flush on Dispose/Close #35

GoogleCodeExporter opened this issue Apr 5, 2015 · 2 comments

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?
1. create JsonTextWriter in using block
2. encode a large json object

What is the expected output? What do you see instead?
content not flushed / malformed JSON

What version of the product are you using? On what operating system?
I checked the latest code checked in and I don't see a call to flush.


Original issue reported on code.google.com by [email protected] on 10 Jun 2011 at 1:26

@GoogleCodeExporter
Copy link
Author

Can you attach a stand-alone sample console that demonstrates this problem?

Original comment by azizatif on 10 Jun 2011 at 4:47

  • Added labels: Component-JSON

@GoogleCodeExporter
Copy link
Author

I can't currently, but I found another instance where this causes a problem 
that you might be able to reproduce more easily:

HttpWebRequest request = WebRequest.Create(_uri_) as HttpWebRequest;
request.Method = "POST";
request.Headers.Add(HttpRequestHeader.ContentEncoding, "application/json; 
charset=UTF8");
using ( JsonWriter writer = new JsonTextWriter(new StreamWriter( 
request.GetRequestStream())))
{
    JsonConvert.Export(RegistrationData_, writer);
}

HttpWebResponse response = request.GetResponse() as HttpWebResponse;

This code will hang because the request stream is never closed/flushed

Original comment by [email protected] on 17 Jun 2011 at 1:07

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant