Thanks Rob for looking into this.
You are right that the older files were not there. I should have easily checked their locations by examining the instances of StorageFile returned by StorageApplicationPermissions.MostRecentlyUsedList.GetFileAsync(ale.Token).
The culprit is that I misunderstood StorageFile.CopyAsync(IStorageFolder). I thought this function would return the new copy of file, but the original instance remains the same. It appears that the original instance changes too after calling this
method. Here is the old code that led to the exception:
await myStorageFile.CopyAsync(TempStorageFolder);
StorageApplicationPermissions.MostRecentlyUsedList.Add(myStorageFile);
Here is the new code that does not have the problem:
StorageApplicationPermissions.MostRecentlyUsedList.Add(myStorageFile);
await myStorageFile.CopyAsync(TempStorageFolder);
I don't think
the MSDN document is clear about the change of the calling instance. Maybe it just follows certain convention that I do know. Could you shed some light on this, Rob?
Hong