XmlSerializer exception message

G

Graham Allwood

Hi,

I am trying to pass some rtf text a a string to a webservice. Now, it is
probably wrong to do this but i does hilight a strange problem.

When I call the webmethod from the client (Windows Forms) I get an exception
from the XmlSerializer, in the debugger the exception message is:

"'\0', hexadecimal value 0x00, is an invalid character. Line 4, position 4."

If I try an display this in the client through MessageBox.Show() I only get
the first charact ('). I guess its because of the null terminator in the
string. But how am I suppose to show this message? Does anyone have any
ideas?

Thanks for your help

Graham
 
H

Herfried K. Wagner [MVP]

* "Graham Allwood said:
I am trying to pass some rtf text a a string to a webservice. Now, it is
probably wrong to do this but i does hilight a strange problem.

When I call the webmethod from the client (Windows Forms) I get an exception
from the XmlSerializer, in the debugger the exception message is:

"'\0', hexadecimal value 0x00, is an invalid character. Line 4, position 4."

If I try an display this in the client through MessageBox.Show() I only get
the first charact ('). I guess its because of the null terminator in the
string. But how am I suppose to show this message? Does anyone have any
ideas?

I assume that you are reading the file with the wrong encoding and so
null characters are found. Null characters are interpreted as string
terminators in some controls. Can you post some code?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top