tags:

views:

45

answers:

2

My program is about triggering XSL transformation,

Its fact that this code for carrying out the transformation, creates some dll and tmp files and deletes them pretty soon after the transformation is completed.

It is almost untraceable for me to monitor the creation and deletion of files manually, so I want to include some chunk of codelines to display "which codeline has created/modified which tmp and dll files" in console window.

This is the relevant part of the code:

            string strXmlQueryTransformPath = @"input.xsl";
            string strXmlOutput = string.Empty;
            StringReader srXmlInput = null;
            StringWriter swXmlOutput = null;
            XslCompiledTransform xslTransform = null;
            XPathDocument xpathXmlOrig = null;
            XsltSettings xslSettings = null;

            MemoryStream objMemoryStream = null;
            objMemoryStream = new MemoryStream();

            xslTransform = new XslCompiledTransform(false);
            xpathXmlOrig = new XPathDocument("input.xml");

            xslSettings = new XsltSettings();
            xslSettings.EnableScript = true;
            xslTransform.Load(strXmlQueryTransformPath, xslSettings, new XmlUrlResolver());

            xslTransform.Transform(xpathXmlOrig, null, objMemoryStream);
            objMemoryStream.Position = 0;
            StreamReader objStreamReader = new StreamReader(objMemoryStream);
            strXmlOutput = objStreamReader.ReadToEnd();
// make use of Data in string "strXmlOutput"

google and msdn search couldn't help me much..

+1  A: 

The temporary DLLs will be created as part of the XSLCompiledTransform object: the XSLT document is compiled at run-time into MSIL and that generated assembly is used to perform the actual transformation. If you really want to work out exactly when the DLL appears/disappears, you could just step through the code, line by line, in a debugger and watch the Temp directory.

Why do you care about the temporary files, though? They're just an implementation detail of the XSL transform code that shouldn't matter to your code.

FacticiusVir
I tried debugging for several times. keeping temp folder open and being observed. but I can't see it creating, I don't know the reason.This creation of temp files is kind of occasional too.. I guess.
infant programmer
well. on the server where this code is deployed is suffering with bug. The files get created but they some how get deleted too, So the program raises an error saying "dll file is missing" (tooo weird..) ..So as a temporary fix of this problem, I have found a work around.. I just have to see there if there is possibility of loading error by myself, if yes, then let me create temp file again and trigger the transformation. (successfully),
infant programmer