[Mono-bugs] [Bug 52837][Blo] New - XmlTextReader.Close() does not close the file.

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Wed, 14 Jan 2004 01:06:07 -0500 (EST)


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by kelvin.ho@kawai.ca.

http://bugzilla.ximian.com/show_bug.cgi?id=52837

--- shadow/52837	2004-01-14 01:06:07.000000000 -0500
+++ shadow/52837.tmp.10573	2004-01-14 01:06:07.000000000 -0500
@@ -0,0 +1,77 @@
+Bug#: 52837
+Product: Mono/Runtime
+Version: unspecified
+OS: 
+OS Details: XP SP1
+Status: NEW   
+Resolution: 
+Severity: 016 Two days
+Priority: Blocker
+Component: misc
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: kelvin.ho@kawai.ca               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: XmlTextReader.Close() does not close the file.
+
+Please fill in this template when reporting a bug, unless you know what 
+you are doing.
+Description of Problem:
+XmlTextReader.Close() does not close the file.
+
+Steps to reproduce the problem:
+1. mcs k.cs -r:System.Data
+2. mono k.exe
+
+k.cs:
+using System;
+using System.IO;
+using System.Xml;
+
+class ReadXmlFile
+{
+   static void Main()
+   {
+      XmlDataDocument xmlDoc = new XmlDataDocument();
+      XmlTextReader reader =
+        new XmlTextReader( "./k.xml" );
+;
+      xmlDoc.Load( reader );
+      reader.Close();
+      xmlDoc.Save( "./k.xml" );
+   }
+}
+
+k.xml:
+<k />
+
+Actual Results:
+I can't write to the samed xml file that I opened and then closed 
+(supposingly) with XmlDataDocument. The same program works with .NET 
+Framework.
+
+Unhandled Exception: System.IO.IOException: Win32 IO returned 
+ERROR_SHARING_VIOL
+ATION. Path: ./k.xml
+in <0x002fa> System.IO.FileStream:.ctor 
+(string,System.IO.FileMode,System.IO.Fil
+eAccess,System.IO.FileShare,int,bool)
+in <0x00043> System.IO.FileStream:.ctor 
+(string,System.IO.FileMode,System.IO.Fil
+eAccess,System.IO.FileShare)
+in <0x00081> (wrapper remoting-invoke-with-check) 
+System.IO.FileStream:.ctor (st
+ring,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare)
+in <0x0003a> System.Xml.XmlTextWriter:.ctor (string,System.Text.Encoding)
+in <0x00046> System.Xml.XmlDocument:Save (string)
+
+Expected Results:
+The xml file can be written successfully.
+
+How often does this happen? 
+Every time.
+
+Additional Information:
+If I call XmlDataDocument.Save() with a different file name, it is OK.