App installed via MSIX package 'forgets' virtual LocalAppData path

625 Views Asked by At

Some temp files are being cached to Environment.GetFolderPath(Environment.SpecialFolder.) + "\\Company\\App";.

At app start the virtual AppData location is assigned. Everything seems to be okay and files are being generated in the virtual directory (C:\Users\User\AppData\Local\Packages\(hash)\LocalCache\Local\Company\App\file.file) as they should be.

After some time while trying to copy files in the same directory it throws:
System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\Users\User\AppData\Local\Company\App\file.file.

The file exists in the virtual directory.

Am I missing something?

1

There are 1 best solutions below

3
On

The app should be looking for the files in the real AppData folder only if the files were already present on the machine. (The real AppData folder has precedence over the virtual one).

Is the real AppData app folder empty/missing or are there any files there from previous tests? Can you reproduce this on a clean machine, in a VM for example?