Sfoglia il codice sorgente

2005-06-05 Gonzalo Paniagua Javier <[email protected]>

	* IsolatedStorageFileStream.cs: check the FileMode here as FileStream
	throws a different exception.


svn path=/trunk/mcs/; revision=45459
Gonzalo Paniagua Javier 20 anni fa
parent
commit
f243382dfd

+ 5 - 0
mcs/class/corlib/System.IO.IsolatedStorage/ChangeLog

@@ -1,3 +1,8 @@
+2005-06-05 Gonzalo Paniagua Javier <[email protected]>
+
+	* IsolatedStorageFileStream.cs: check the FileMode here as FileStream
+	throws a different exception.
+
 2005-04-25  Sebastien Pouliot  <[email protected]>
 
 	* INormalizeForIsolatedStorage.cs: Added [ComVisible(true)] for 2.0.

+ 5 - 2
mcs/class/corlib/System.IO.IsolatedStorage/IsolatedStorageFileStream.cs

@@ -47,11 +47,14 @@ namespace System.IO.IsolatedStorage {
 	public class IsolatedStorageFileStream : FileStream {
 
 		[ReflectionPermission (SecurityAction.Assert, TypeInformation = true)]
-		private static string CreateIsolatedPath (IsolatedStorageFile isf, string path)
+		private static string CreateIsolatedPath (IsolatedStorageFile isf, string path, FileMode mode)
 		{
 			if (path == null)
 				throw new ArgumentNullException ("path");
 
+			if (!Enum.IsDefined (typeof (FileMode), mode))
+				throw new ArgumentException ("mode");
+
 			if (isf == null) {
 				// we can't call GetUserStoreForDomain here because it depends on 
 				// Assembly.GetCallingAssembly (), which would be our constructor,
@@ -107,7 +110,7 @@ namespace System.IO.IsolatedStorage {
 		// FIXME: Further limit the assertion when imperative Assert is implemented
 		[FileIOPermission (SecurityAction.Assert, Unrestricted = true)]
 		public IsolatedStorageFileStream (string path, FileMode mode, FileAccess access, FileShare share, int bufferSize, IsolatedStorageFile isf)
-			: base (CreateIsolatedPath (isf, path), mode, access, share, bufferSize, false, true)
+			: base (CreateIsolatedPath (isf, path, mode), mode, access, share, bufferSize, false, true)
 		{
 		}