Microsoft KB Archive/318143

= FIX: XML Input File Erased When You Use Transform Method of XslTranform Object =

Article ID: 318143

Article Last Modified on 4/28/2003

-

APPLIES TO


 * Microsoft .NET Framework Class Libraries 1.1
 * Microsoft .NET Framework 1.0

-



This article was previously published under Q318143



SYMPTOMS
This bug was corrected in P1. When you use the Transform method of the XslTransform object, you may receive the following System.IO.IOException error message, and the original input file is empty:

An unhandled exception of type 'System.IO.IOException' occurred in system.xml.dll

The process cannot access the file &quot;filename&quot; because it is being used by another process.



CAUSE
The input XML file name and output file name are the same.



RESOLUTION
To resolve this problem, make sure that the input file name and the output file name are different.



STATUS
This bug was corrected in Microsoft .NET Framework 1.1.



Steps to Reproduce the Behavior
  Use Microsoft Notepad to create a new XML document that contains the following code, and then save the document as Library.xml in the root folder of your hard disk:  Pride And Prejudice  Hook   Use Notepad to create a new XML document that contains the following code, and then save the document as Msg.xsl in the root folder of your hard disk:   Root node is   </xsl:stylesheet> </li>  In Microsoft Visual Basic .NET, create a new Console Application project, and then replace the code in Module1.vb with the following code: Imports System.Xml.Xsl

Module Module1

Sub Main Dim objXsl As XslTransform objXsl = New XslTransform objXsl.Load(&quot;c:\msg.xsl&quot;) objXsl.Transform(&quot;c:\library.xml&quot;, &quot;c:\library.xml&quot;) End Sub

End Module </li>  Run the project. Note that you receive an error message, and the input file is erased. To resolve the problem, change the line that performs the Transform method, as follows: objXsl.Transform(&quot;c:\library.xml&quot;, &quot;c:\library1.xml&quot;) </li></ol>

Keywords: kbbug kbpending KB318143

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.