473,324 Members | 2,535 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

Trace class truncates string when it contains null chars???

Hello,

using the WriteLine method of the Trace class I noticed that strings
containing null characters (i.e. \0) get truncated in the output window at
the first null char and anything that follows simply gets lost. I'm using
..NET 1.1 (have not tested with 2.0).

Try the following to see what I mean:

Trace.WriteLine("xxxx\0\0xxxx");

Is there a way to avoid this behavior???

Regards,
Bob Rock
Dec 28 '06 #1
1 1476

"Bob Rock" <ye********************@hotmail.com.nospamwrote in message
news:uz**************@TK2MSFTNGP06.phx.gbl...
Hello,

using the WriteLine method of the Trace class I noticed that strings
containing null characters (i.e. \0) get truncated in the output window at
the first null char and anything that follows simply gets lost. I'm using
.NET 1.1 (have not tested with 2.0).

Try the following to see what I mean:

Trace.WriteLine("xxxx\0\0xxxx");

Is there a way to avoid this behavior???
I believe that's because the actual protocol used to send strings to the
debugger uses standard C strings (NUL-terminated). Tracing into a logfile,
for example, wouldn't have that problem.

You may want to scan your string for control characters and convert them to
escape sequences, so that you would get @"xxxx\0\0xxxx" with the characters
\0 actually appearing, in case you need to know about the presence of the
control characters.
>
Regards,
Bob Rock


Dec 29 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: lesperancer | last post by:
I've read all the posts, but nothing works I've got a table with an ID field and a memo field one record in the table, with the memo field having 322 chars I open the table, and then use the...
16
by: Christopher Benson-Manica | last post by:
I'm wondering about the best way to do the following: I have a string delimited by semicolons. The items delimited may be in any of the following formats: 1) 14 alphanum characters 2) 5...
4
by: Simon Schaap | last post by:
Hello, I have encountered a strange problem and I hope you can help me to understand it. What I want to do is to pass an array of chars to a function that will split it up (on every location where...
4
by: Dim | last post by:
I found that C# has some buggy ways to process string across methods. I have a class with on global string var and a method where i add / remove from this string Consider it a buffer... with some...
3
by: Adie | last post by:
I'm using async-callbacks for a socket client. I have a class doing the work with the server - includes the socket, AsyncResult, AsynCallback etc.. (call it client for arguments sake) Also a...
1
by: bunty.gopal | last post by:
This is the solution to the issue in the subject, question itself was posted in a previous thread long back. Use the latest DB2 db2cc.jar fixpack on the client, or add "deferPrepares=false" to...
2
by: Benny | last post by:
Is there a way to trace exceptions and messages captured with the Enterprise Library to a custom destination like a text box or any other control? If not can anyone think of a way to "hack"...
2
by: mccalla | last post by:
Hi, I am very new to MS Access. I have inherited an existing app which was done in MS Access 2003. In this app, there is a report which contains a memo field. There are no formats, functions,...
5
Shakss2
by: Shakss2 | last post by:
Hi... I am exporting some data from a table with a memo field to excel but the excel report truncates the memo field data to 255 chars. Dim strPath As String ' Current path strPath =...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.