[Mono-bugs] [Bug 75285][Nor] New - DirectoryInfo.Last****Time
results in UnauthorizedAccessException on Windows
bugzilla-daemon at bugzilla.ximian.com
bugzilla-daemon at bugzilla.ximian.com
Thu Jun 16 14:33:43 EDT 2005
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 gert.driesen at pandora.be.
http://bugzilla.ximian.com/show_bug.cgi?id=75285
--- shadow/75285 2005-06-16 14:33:43.000000000 -0400
+++ shadow/75285.tmp.1083 2005-06-16 14:33:43.000000000 -0400
@@ -0,0 +1,76 @@
+Bug#: 75285
+Product: Mono: Runtime
+Version: 1.1
+OS:
+OS Details:
+Status: NEW
+Resolution:
+Severity:
+Priority: Normal
+Component: io-layer
+AssignedTo: mono-bugs at ximian.com
+ReportedBy: gert.driesen at pandora.be
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: DirectoryInfo.Last****Time results in UnauthorizedAccessException on Windows
+
+Setting one of the following properties on a DirectoryInfo instance on
+Windows results in an UnauthorizedAccessException:
+
+DirectoryInfo.LastWriteTime
+DirectoryInfo.LastWriteTimeUtc
+DirectoryInfo.LastAccessTime
+DirectoryInfo.LastAccessTimeUtc
+DirectoryInfo.CreationTime
+DirectoryInfo.CreationTimeUtc
+
+To reproduce this issue, compile and run the following code snippet on
+Windows:
+
+using System;
+using System.IO;
+
+public class EntryPoint
+{
+ public static void Main ()
+ {
+ string tempDir = CreateTempDirectory ();
+
+ try {
+ DirectoryInfo dir = new DirectoryInfo (tempDir);
+ dir.LastAccessTime = DateTime.Now;
+ dir.LastAccessTimeUtc = DateTime.Now;
+ dir.LastWriteTime = DateTime.Now;
+ dir.LastWriteTimeUtc = DateTime.Now;
+ dir.CreationTime = DateTime.Now;
+ dir.CreationTimeUtc = DateTime.Now;
+ } finally {
+ Directory.Delete (tempDir, true);
+ }
+ }
+
+ private static string CreateTempDirectory ()
+ {
+ string tempdir = Path.Combine (Path.GetTempPath (), "DirInfoTest");
+ Directory.CreateDirectory (tempdir);
+ return tempdir;
+ }
+}
+
+Actual result:
+
+Unhandled Exception: System.UnauthorizedAccessException: Access to the
+path "C:\DOCUME~1\drieseng\LOCALS~1\Temp\DirInfoTest" is denied.
+in <0x00076> System.IO.FileSystemInfo:set_LastAccessTime (DateTime value)
+in (wrapper remoting-invoke-with-check)
+System.IO.FileSystemInfo:set_LastAccessTime (System.DateTime)
+in <0x0005a> EntryPoint:Main ()
+
+Expected result:
+
+No failure(s).
+
+Note: I'll commit some small unit tests for this issue to svn, in
+DirectoryInfoTest.cs.
More information about the mono-bugs
mailing list