Visual Studio and .NET Framework Home
C# LastWriteTime BUG
as By Design
6/9/2006 1:59:49 AM
User(s) can reproduce this bug
When we read the LastWriteTime from some files, the Time is reporting back an hour off.
Visual Studio 2005 Standard Edition
Windows 2000 Advanced Server
Operating System Language
Steps to Reproduce
DateTime date = new DateTime();
FileInfo file = new FileInfo("C:\WEB.CONFIG");
date = file.LastWriteTime;
when we read the LastWriteTime from some files, the Time is reporting back an hour off.
CORRECT LastWriteTime VALUE
to post a comment.
Please enter a comment.
on 1/19/2009 at 7:50 AM
It would be nice if you could fix this.
.NET framework reports wrong time info for files when adjust clock for daylight savings is set, which makes any application based on .NET framework and file dates to fail under such conditions.
You can reproduce it from http://www.codeproject.com/KB/files/csharpfiledate.aspx?msg=2885854#xx2885854xx
on 7/20/2006 at 10:13 AM
Thanks for reporting this issue. This is probably due to multiple handles for this file being opened when this property is called. Our current implementation uses FileFirstFile to get the last write time if GetFileAttributesEx returns an error http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sysinfo/base/file_times.asp has more information on the reason for the time difference for last write time with FileFirstFile.
on 7/10/2006 at 12:00 AM
Thanks for the response, we are unable to repro the issue with the repro steps provided. If you could provide us with a sample project/solution and the exact repro steps, we would still like to address the issue.
Nagesh, Visual Studio Product Team
on 7/9/2006 at 11:49 PM
Thank you for your feedback. We are investigating this issue.
Thank you, Visual Studio Product Team.
to post a workaround.
Please enter a workaround.
© 2014 Microsoft