[Mono-bugs] [Bug 46077][Nor] New - FileShare Enumeration is not implemented by Mono
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 email@example.com.
--- shadow/46077 Thu Jul 10 06:20:49 2003
+++ shadow/46077.tmp.3023 Thu Jul 10 06:20:49 2003
@@ -0,0 +1,75 @@
+OS: Red Hat 9.0
+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
+/* EXAMPLE */
+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 opening the same file, which was locked by the previous
+ nextfi.Open( FileMode.OpenOrCreate, FileAccess.Read );
+ Console.WriteLine("The file was not locked, and was opened by a
+ catch (IOException)
+ Console.WriteLine("The file could not be opened because it was
+locked by another process.");
+ catch (Exception e)
+ // Close the file so it can be deleted.
+/* 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.