[mono-android] Can't set CreationTime on File

Paul Johnson paul at all-the-johnsons.co.uk
Tue Jul 23 11:39:09 UTC 2013


Hi,

> I think, the following code worked in the past but now I get an error when
> setting the timestamps (Invalide Parameter).
>
> FileInfo fi = new FileInfo(file);
> fi.Attributes = FileAttributes.Normal; <-works
> fi.CreationTime = timeCreate;  <-fail
> fi.LastWriteTime = timeLastWrite; <-fail
> fi.LastAccessTime = timeLastWrite; <-fail
> fi = null;
>
> My mono-version hasn't changed (still 4.2.7) for month, now.
> Has google something changed in Android that prevents changing filetimes?

Can you create a small test case showing the problem? If you've not 
changed anything, the code should still work.

4.2.7 of Xamarin.Android is really old (the alpha version is on 4.8.0 
with the stable being 4.6.8) and all of them IIRC use the mono-3 branch now.

You might want to try

fi.CreationTime = timeCreate.TimeOfDay;

as well

Paul
-- 
"Voila! In view humble vaudevillian veteran, cast vicariously as both 
victim and villain by the vicissitudes of fate. This visage, no mere 
veneer of vanity, is a vestige of the “vox populi” now vacant, vanished. 
However, this valorous visitation of a bygone vexation stands vivified, 
and has vowed to vanquish these venal and virulent vermin, van guarding 
vice and vouchsafing the violently vicious and voracious violation of 
volition.
The only verdict is vengeance; a vendetta, held as a votive not in vain, 
for the value and veracity of such shall one day vindicate the vigilant 
and the virtuous.
Verily this vichyssoise of verbiage veers most verbose, so let me simply 
add that it’s my very good honour to meet you and you may call me V.."



More information about the Monodroid mailing list