Thanks a lot, I was able to find the problem. When concatenating the string
I was using a value obtained from a buffer, I was not correctly splitting
the buffer so the resulting variable was es big as the buffer.
"Jon Skeet [C# MVP]" <sk***@pobox.com> escribió en el mensaje
news:MP************************@msnews.microsoft.c om...
Juan <ju*****************@ANTISPAMhotmail.com> wrote:
Does any one know if there are reported bugs when concatenating strings?
There are lots of *reported* bugs. Almost all turn out to be user error
or a problem in the debugger.
When debugging each variable has the correct value but when I try to
concatenate them some values are missing (I can´t see them in the
debugger).
I suggest not using the debugger to diagnose this, as it can be
confusing when the string contains null characters (character 0).
After encoding the string (the sameone which complete value is not visible
from the debugger) all the values can be seen but they are spaced by big
amounts of zeros and use more that the 2048 bytes allocated. It is like if
some of the string variables that I concatenate have a some "unused" space
that can not be seen....
You haven't actually shown any string concatenation code. However...
Byte[] buffer = new Byte[2048]
buffer = System.Text.Encoding.ASCII.GetBytes(string.ToCharA rray());
I hope I could made myself clear!
That doesn't end up with a 2K buffer. It ends up with a buffer of
however long the string is. (You don't need to call ToCharArray, by the
way - just use the version of Encoding.GetBytes which takes a string.)
The first line of your code is effectively useless - you're just
creating an array and then ignoring it in the next line of code, as
you're assigning a new value to "buffer".
--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too