[Mono-bugs] [Bug 46077][Nor] New - FileShare Enumeration is not implemented by Mono
bugzilla-daemon@rocky.ximian.com
bugzilla-daemon@rocky.ximian.com
Thu, 10 Jul 2003 06:20:49 -0400 (EDT)
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 richard.torkar@htu.se.
http://bugzilla.ximian.com/show_bug.cgi?id=46077
--- shadow/46077 Thu Jul 10 06:20:49 2003
+++ shadow/46077.tmp.3023 Thu Jul 10 06:20:49 2003
@@ -0,0 +1,75 @@
+Bug#: 46077
+Product: Mono/Runtime
+Version: unspecified
+OS: Red Hat 9.0
+OS Details:
+Status: NEW
+Resolution:
+Severity:
+Priority: Normal
+Component: misc
+AssignedTo: mono-bugs@ximian.com
+ReportedBy: richard.torkar@htu.se
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: FileShare Enumeration is not implemented by Mono
+
+The following code snippet (from msdn) shows that mono does not yet
+implement FileShare.None correctly. (The library seems to have the enum at
+least :)
+
+/* EXAMPLE */
+
+using System;
+using System.IO;
+
+
+public class OpenTest
+{
+ public static void Main()
+ {
+ // Open an existing file, or create a new one.
+ FileInfo fi = new FileInfo("temp.txt");
+
+
+ // Open the file just specified such that no one else can use it.
+ FileStream fs = fi.Open( FileMode.OpenOrCreate,
+FileAccess.ReadWrite, FileShare.None );
+
+
+ // Create another reference to the same file.
+ FileInfo nextfi = new FileInfo("temp.txt");
+
+
+ try
+ {
+ // Try opening the same file, which was locked by the previous
+process.
+ nextfi.Open( FileMode.OpenOrCreate, FileAccess.Read );
+
+
+ Console.WriteLine("The file was not locked, and was opened by a
+second process.");
+ }
+ catch (IOException)
+ {
+ Console.WriteLine("The file could not be opened because it was
+locked by another process.");
+ }
+ catch (Exception e)
+ {
+ Console.WriteLine(e.ToString());
+ }
+
+
+ // Close the file so it can be deleted.
+ fs.Close();
+ }
+}
+
+/* END EXAMPLE */
+
+At the moment, latest mono cvs (2003-07-09) gives this:
+The file was not locked, and was opened by a second process.