whats the total number of ds in:
q: workflow gives error occured when uploading file to document library i am mapping one xml document to another. when it is done, i am uploading that document to a document library. here is the code that does that:
                memorystream ms = new memorystream();
            xmlwritersettings xws = new xmlwritersettings();
            xws.omitxmldeclaration = false;
            xws.indent = true;

            using (xmlwriter xw = xmlwriter.create(ms, xws))
            {
                outputdocumentinfo.xdoc.writeto(xw);
            }

            spfolder mylibrary = web.folders[sitecollectioninfo.documentlibraryname];

            // set allowunsafeupdates = true to avoid security error
            web.allowunsafeupdates = true;

            mylibrary.files.add(outputdocumentinfo.filename + .xml, ms, true);                

            mylibrary.update();

            web.allowunsafeupdates = false;

when the file is done uploading, it is valid and well formed xml. i can open it, submit, edit it, everything, but the status of the workflow says error occurred and the workflow will not start for that item. under workflow settings i have made sure that  start this workflow when a new item is created is checked.
anyone know what might be causing this?
edit: when i download that same xml file and re-upload it (without making any changes) using the upload document button inside the document library, the workflow will start just fine.

a: do not use 
web.allowunsafeupdates = false;
inside the workflow code instead use 
using (spweb web= workflowproperties.web)
{
web.allowunsafeupdates = true;

}

this will resolve yor issue 

user
In that passage, there are 52 occurrences of the letter "d."
assistant