Application stopped writing to AppData

144 Views Asked by At

I had a .Net WPF application packaged for the Windows Store. It didn't have folder virtualization. I.e. It wrote to %AppData%.

I have now reinstalled Windows (10) on my PC and now it does folder virtualization, I.e. it doesn't write to %AppData%. See Microsoft's documentation here that this shouldn't be happening (If I understood it correctly).

(The Windows version might have updated upon reinstallation even though it was on the latest build before the reinstall, perhaps it got an optional Windows update. The version now is 19045.2130.)

I tested this both from the Windows Store, and from Visual Studio.

Why would folder virtualization change?

1

There are 1 best solutions below

0
Tim On

As mentioned in the post that you linked, Microsoft made a change in the 1903 version that added this feature to your packaged fulltrust app. Nothing has recently changed about this since, so I don't know why you are now noticing the behavior, but possibly in how you are looking.

When your app writes to %APPDATA%, the file will be redirected to a private area (under %LocalAppData%/Packages/\LocalCache...). The app running in the package will see the changed files when it references %APPDATA% for the file path. An external file explorer will only see the data files in the redirected location.

Assuming that it was important for the app to write to %APPDATA% for the purpose of roaming that data (via Roaming Profiles, Folder Redirection, or a UEM product), this is a problem for you.

  • UEM products can be configured to pick up from this new location instead.
  • You can add the PSF FileRedirectionFixup to your package to redirect to a home drive location - which directly maps to the Folder Redirection case.
  • For the other scenarios, the alternative, of course, is to upgrade your source code to store settings using the System.Configuration API which was added to .Net Framework 4.8.

Tim