During my work with XML in .NET I ran across strange behavior of passing stream into a XmlTextReader object. When I tried to read a stream I received an error “XmlException: Root element is missing”. I investigated a structure of XML file, but the problem was elsewhere. It turned out, that in magic way the position in the stream was moved forward! So I tried to read an XML without first characters.
Position in stream before calling a constructor was zero: