Hi,

I have a problem which I can't figure out. I have code in C# which calls a native function via COM interface.
I have an object which I serialize to XML, then pass the string to the native C++ code which I use mxsml (4) to handle.

The flow is:

Code:
//--- C#
MemoryStream memStream = new MemoryStream();
myObject.ExportToXml(memStream);

/* Inside there is something like this:
      {
         XmlTextWriter xmlWriter = new XmlTextWriter(memStream, null);
         // here I build the XML
      }
*/

string xmlString = Encoding.UTF8.GetString(memStream.ToArray());

    //--- COM C++
    myComObject.passXmlOn(xmlString); // MyComObject::passXmlOn(BSTR)
    // here the native object is accessed and handleXml is called

        //--- Native C++
        myNativeObj.handleXml(xmlString); // MyNativeObj::handleXml(wstring)
            // here MSXML2::DOMDocument40::loadXml(xmlString) is called
At this point I try to create an MSXML object, and it fails.

However, when I write the XML to file (I pass FileStream to my ExportToXml) and then I create the MSXML in the native code from the same file, everything works fine.

Code:
FileStream fileStream = new FileStream(someFileLocation);
myObject.ExportToXml(fileStream);


    //--- COM C++
    myComObject.readXml(); 
    // here the native object is accessed and handleXml is called

        //--- Native C++
        myNativeObj.handleXml(); // MyNativeObj::handleXml()
            // here MSXML2::DOMDocument40::load(someFileLocation) is called
Any ideas?

Thanks,