[Mono-bugs] [Bug 81669][Wis] New - Icon..ctor(String filename) needs Write access to the file

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Fri May 18 07:41:12 EDT 2007


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 andyhume32 at yahoo.co.uk.

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

--- shadow/81669	2007-05-18 07:41:12.000000000 -0400
+++ shadow/81669.tmp.16819	2007-05-18 07:41:12.000000000 -0400
@@ -0,0 +1,49 @@
+Bug#: 81669
+Product: Mono: Class Libraries
+Version: 1.2
+OS: 
+OS Details: XP SP2
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Wishlist
+Component: Sys.Drawing.
+AssignedTo: mono-bugs at ximian.com                            
+ReportedBy: andyhume32 at yahoo.co.uk               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Icon..ctor(String filename) needs Write access to the file
+
+Icon..ctor(String filename) needs Write access to the file
+
+Mono 1.2.4. (installer).  Tested only on Windows XP SP2, where it always 
+occurs.
+
+See the repro code in bug 81667--"Crash from NotifyIcon.HideSystray on 
+Form exit if not fully configured".  The repro code there attempts to 
+use "new Icon(filename)" and then on exception falls back to opening the 
+icon file with File.Open read manually.  i.e.:
+
+  try {
+    Icon ico = new Icon(s_iconFilename);
+    m_notifyIcon.Icon = ico;
+  } catch (UnauthorizedAccessException) {
+    Console.WriteLine("UnauthorizedAccessException on opening icon file, 
+doing manually!!");
+    System.IO.Stream strm = System.IO.File.OpenRead(s_iconFilename);
+    Icon ico = new Icon(strm);
+    m_notifyIcon.Icon = ico;
+  }
+
+If I pass a filename to an icon that I have only read access to, the "new 
+Icon(filename)" call fails with UnauthorizedAccessException, but the 
+operations succeed when the file open is done manually.
+
+On mono one sees that exception is thrown (the Console.WriteLine output 
+is seen on the console).  On MSFT CLR v2, the exception does not occur.
+
+Presumably Icon.cs needs ", FileAccess.Read" added to its three "new 
+FileStream" calls.  Icon2.jvm.cs one.  System.Windows.Forms\Cursor.cs 
+needs one?


More information about the mono-bugs mailing list