[Mono-bugs] [Bug 79250][Wis] New - FileShare.Delete not accepted by System.IO.FileStream ctor

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Fri Sep 1 15:36:45 EDT 2006


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 ladislav.prosek at matfyz.cz.

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

--- shadow/79250	2006-09-01 15:36:45.000000000 -0400
+++ shadow/79250.tmp.27386	2006-09-01 15:36:45.000000000 -0400
@@ -0,0 +1,64 @@
+Bug#: 79250
+Product: Mono: Class Libraries
+Version: 1.1
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Wishlist
+Component: CORLIB
+AssignedTo: mono-bugs at ximian.com                            
+ReportedBy: ladislav.prosek at matfyz.cz               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: FileShare.Delete not accepted by System.IO.FileStream ctor
+
+Please fill in this template when reporting a bug, unless you know what you
+are doing.
+Description of Problem:
+
+FileStream..ctor performs this suspicious check:
+
+      if ((share < FileShare.None) || (share > FileShare.ReadWrite))
+      {
+            throw new ArgumentOutOfRangeException("share", "Enum value was
+out of legal range.");
+      }
+ 
+FileShare.Delete happens to have the value 4, which is unfortunately
+FileShare.ReadWrite (= 3) :)
+
+Steps to reproduce the problem:
+
+using System;
+using System.IO;
+
+namespace ConsoleApplication1
+{
+	class Program
+	{
+		static void Main(string[] args)
+		{
+			Stream s = new FileStream(
+					@"C:\Temp\test",
+					FileMode.Open,
+					FileAccess.Read,
+					FileShare.ReadWrite | FileShare.Delete);
+		}
+	}
+}
+
+
+Actual Results:
+Unhandled Exception: System.ArgumentOutOfRangeException: Enum value was out
+of legal range.
+Parameter name: share
+
+Expected Results:
+-
+
+How often does this happen? 
+Always.


More information about the mono-bugs mailing list