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

ReadLine() returns string with embedded null characters '\0' #1

Open
michaelplevy opened this issue Mar 17, 2014 · 0 comments
Open

Comments

@michaelplevy
Copy link

We're using PooledSocket.cs. Memcached was returning an "object too large" error, but the response returned had embedded null characters. When I logged the error, my logging library truncated the strings at the null character which caused a bit of confusion for me. Logging Exception.toString() the Message came through, but the stack trace was lost.

I made a small change in PooledSocket that might be helpful. I keep count of the bytes written to the buffer, then:

return Encoding.UTF8.GetString(buffer.GetBuffer(), 0, count);

which only returns the bytes written and not the entire buffer.

Is there a better solution?

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

No branches or pull requests

1 participant