Bug 52561 - Apps modified date is displayed as 01/01/1970 00:00:00 in iOS 10.2
Summary: Apps modified date is displayed as 01/01/1970 00:00:00 in iOS 10.2
Status: ASSIGNED
Alias: None
Product: iOS
Classification: Xamarin
Component: Xamarin.iOS.dll (show other bugs)
Version: XI 10.3 (iOS 10.2)
Hardware: PC Windows
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2017-02-16 09:59 UTC by Saravanan
Modified: 2017-11-07 11:01 UTC (History)
3 users (show)

See Also:
Tags:
Is this bug a regression?: ---
Last known good build:


Attachments
repro project (16.43 KB, application/zip)
2017-02-17 23:11 UTC, Jimmy [MSFT]
Details

Description Saravanan 2017-02-16 09:59:41 UTC
Trying to get last modified date of application. Getting correctly in iOS 10.1 and below but getting 01/01/1970 00:00:00 always in iOS 10.2 for ModificationDate and CreationDate of NSFileManager. Please find following sample code.

const string c_Info = "Info";
const string c_Plist = "plist";
NSString pathToInfoPlist = (NSString) NSBundle.MainBundle.PathForResource(c_Info, c_Plist);
NSString pathToAppBundle = pathToInfoPlist.DeleteLastPathComponent();
NSFileAttributes fileAttributes = NSFileManager.DefaultManager.GetAttributes(pathToAppBundle);
DateTime updateDate = fileAttributes.ModificationDate.ToDateTime();
DateTime lastUpdateDate = new DateTime(updateDate.Year, updateDate.Month, updateDate.Day, updateDate.Hour, updateDate.Minute, updateDate.Second, updateDate.Millisecond);
return lastUpdateDate;
Comment 1 Timothy Risi 2017-02-17 19:56:20 UTC
Hello,

Can you post your full environment information?

The easiest way to get exact version information is to use the 
"Xamarin Studio" menu, "About Xamarin Studio" item, "Show Details" 
button and copy/paste the version informations (you can use the 
"Copy Information" button).

Also, what does your ToDateTime () extension do (I'm assuming it's an extension since I don't see that method on date time).  I tested the following code and I am getting the correct Date and Time showing.  I'm using XI 10.4.0.121 and targeting iOS 10.2 with the app.

const string c_Info = "Info";
			const string c_Plist = "plist";
			NSString pathToInfoPlist = (NSString)NSBundle.MainBundle.PathForResource (c_Info, c_Plist);
			NSString pathToAppBundle = pathToInfoPlist.DeleteLastPathComponent ();
			NSFileAttributes fileAttributes = NSFileManager.DefaultManager.GetAttributes (pathToAppBundle);
			var updateDate = (DateTime)fileAttributes.ModificationDate;
			DateTime lastUpdateDate = new DateTime (updateDate.Year, updateDate.Month, updateDate.Day, updateDate.Hour, updateDate.Minute, updateDate.Second, updateDate.Millisecond);
			Console.WriteLine (lastUpdateDate);
Comment 2 Jimmy [MSFT] 2017-02-17 23:11:53 UTC
Created attachment 19870 [details]
repro project

I am marking this as CONFIRMED since I am able to reproduce this issue on an iOS 10.2 device with the attached project. 

The issue does not occur on an iOS 10.1 device or iOS 10.2 simulator.

### Steps to Reproduce 
1. Run the attached iOS project


### Version Info
=== Xamarin Studio Enterprise ===

Version 6.2 (build 1812)
Installation UUID: 94ce5106-6a72-4691-b34e-cd5857b1db66
Runtime:
	Mono 4.8.0 (mono-4.8.0-branch/9ac5bf2) (64-bit)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 408000489

=== NuGet ===

Version: 3.5.0.0

=== Xamarin.Profiler ===

Version: 1.1.99
Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler

=== Xamarin.Android ===

Version: 7.1.0.35 (Visual Studio Enterprise)
Android SDK: /Users/jimmygarrido/Library/Developer/Xamarin/android-sdk-macosx
	Supported Android versions:
		2.3   (API level 10)
		4.0.3 (API level 15)
		4.1   (API level 16)
		4.4   (API level 19)
		5.0   (API level 21)
		5.1   (API level 22)
		6.0   (API level 23)
		7.0   (API level 24)
		7.1   (API level 25)

SDK Tools Version: 25.2.5
SDK Platform Tools Version: 25.0.3
SDK Build Tools Version: 25.0.2

Java SDK: /usr
java version "1.8.0_102"
Java(TM) SE Runtime Environment (build 1.8.0_102-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.102-b14, mixed mode)

Android Designer EPL code available here:
https://github.com/xamarin/AndroidDesigner.EPL

=== Xamarin Android Player ===

Version: 0.6.5
Location: /Applications/Xamarin Android Player.app

=== Apple Developer Tools ===

Xcode 8.2.1 (11766.1)
Build 8C1002

=== Xamarin.iOS ===

Version: 10.4.0.121 (Visual Studio Enterprise)
Hash: 9d6e1ab
Branch: cycle9
Build date: 2017-02-10 12:10:51-0500

=== Xamarin Inspector ===

Version: 1.1.1.0
Hash: 607f1ba
Branch: 1.1-release
Build date: Thu, 16 Feb 2017 18:57:39 GMT

=== Xamarin.Mac ===

Version: 3.0.0.391 (Visual Studio Enterprise)

=== Build Information ===

Release ID: 602001812
Git revision: 33e69e5df3c62c2c4084cf1b8de26fda93c5e843
Build date: 2017-02-09 12:18:09-05
Xamarin addins: 984f6bd4e491490d1cdf37352594300dab2b1597
Build lane: monodevelop-lion-cycle9

=== Operating System ===

Mac OS X 10.12.3
Darwin Jimmys-MBP 16.4.0 Darwin Kernel Version 16.4.0
    Thu Dec 22 22:53:21 PST 2016
    root:xnu-3789.41.3~3/RELEASE_X86_64 x86_64

=== Enabled user installed addins ===

xUnit.NET 2 testing framework support 0.6.13
Redth's Addins 1.0.4
Comment 4 Saravanan 2017-11-07 11:01:16 UTC
This issue is still appear in iOS 11. Please update when will be resolved.

Note You need to log in before you can comment on or make changes to this bug.