[weird problem] the xm file transfered by wcf,some sections in it were always repeated

some sections in xml are always repeated,I received these file by wcf.

I thought it's caused by buffersize of wcf or flush method of stream.(I don't what meaning of flush method is)

it took me about an half day to find cause of this probelm.and now,I find it's because I close stream in another thread.

why close stream in another stream?

I intended to visit property of stream in another thread,but system throw exption somtimes because the stream was closed.so I closed stream after visited property of stream.

the resolution is if canread is true then visit property in another stream and close stream in current thread.that's right.

原文地址:https://www.cnblogs.com/langu/p/3949158.html