views:

267

answers:

2

I'm having a really strange issue serializing to an MSMQ and back.

The object being serialized contains a string array; one of the strings in the array contains spaces and carriage returns ("\r\n"). The object is constructed fine and seems to serialize without a problem, but when I deserialize it (in another project), the array now contains an item for every individual word and space.

i.e.:
the array { "first", "this is a test string" }
becomes { "first", "this", "", "is", "", "a", "", "test, "", "string" }

I have no idea what's going on... as far as the serialization, I'm using MessageQueue.Send() and System.XML.Serialization.

Any help?

+1  A: 

\r\n seem to be messing up your serialization. Can you intercept the serialization and replace them with another set of characters before dehydrating them and then adding them back when re-hydrating?

Chris Ballance
I've tried that and get the same results. Thanks though.
Luke
A: 

What does the serialized xml look like? If you look at the actual xml output, you should be able to tell whether it is the serializer or deserializer that is causing the problem, which would certainly help in attempting a fix.

With that said, i will say that i very often serialize objects that contain the exact formation of data you are specifying and i am fairly certain i've never seen this behavior.

Perhaps a code example to repro the issue would be helpful.

Brian Rudolph