[Mono-bugs] [Bug 68260][Nor] New - ResXResourceReader fails with read-only files
bugzilla-daemon@bugzilla.ximian.com
bugzilla-daemon@bugzilla.ximian.com
Wed, 13 Oct 2004 16:09:42 -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 karl@waclawek.net.
http://bugzilla.ximian.com/show_bug.cgi?id=68260
--- shadow/68260 2004-10-13 16:09:42.000000000 -0400
+++ shadow/68260.tmp.14107 2004-10-13 16:09:42.000000000 -0400
@@ -0,0 +1,72 @@
+Bug#: 68260
+Product: Mono: Class Libraries
+Version: unspecified
+OS: Red Hat 9.0
+OS Details:
+Status: NEW
+Resolution:
+Severity:
+Priority: Normal
+Component: Windows.Forms
+AssignedTo: mono-bugs@ximian.com
+ReportedBy: karl@waclawek.net
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: ResXResourceReader fails with read-only files
+
+Description of Problem:
+=======================
+
+When opening a read-only file (permissions = 444) with
+System.Resources.ResXResourceReader, an UnauthorizedAccessException
+is thrown. However, this works on Windows under MS.NET 1.1.
+
+Steps to reproduce the problem:
+===============================
+
+Example function, to use on read-only file:
+
+ /// <summary>
+ /// Converts resource file from .resx format to .resources format.
+ /// </summary>
+ /// <param name="resxSource">Fully qualified source file name.</param>
+ /// <param name="resourceTarget">Fully qualified target file
+name.</param>
+ public static void ConvertResources(string resxSource, string
+resourceTarget)
+ {
+ ResXResourceReader resReader = new ResXResourceReader(resxSource);
+ IDictionaryEnumerator resEnum = resReader.GetEnumerator();
+ ResourceWriter resWriter = new ResourceWriter(resourceTarget);
+ while (resEnum.MoveNext())
+ resWriter.AddResource((string)resEnum.Key, resEnum.Value);
+ resReader.Close();
+ resWriter.Close();
+ }
+
+
+Actual Results: (from my app)
+===============
+
+Unhandled Exception: System.UnauthorizedAccessException: Access to the
+path "/home/kwaclaw/Mono/saxdotnet/Org.System.Xml/Xml.resx" is denied.
+in <0x0047d> System.IO.FileStream:.ctor
+(string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare,int,boo
+l)
+in <0x00051> System.IO.FileStream:.ctor (string,System.IO.FileMode)
+in <0x00065> (wrapper remoting-invoke-with-check)
+System.IO.FileStream:.ctor (string,System.IO.FileMode)
+in <0x00110> System.Resources.ResXResourceReader:.ctor (string)
+in <0x0003e> Build.BaseBuilder:ConvertResources (string,string)
+in <0x001f8> Build.Sax.Builder:Main (string[])
+
+
+Expected Results:
+=================
+
+Successful execution, no exception.
+
+
+Karl