dotnet / maui

.NET MAUI is the .NET Multi-platform App UI, a framework for building native device applications spanning mobile, tablet, and desktop.
https://dot.net/maui
MIT License
22.26k stars 1.76k forks source link

FileSystem.Current.AppDataDirectory returns different path after updating to latest version #25981

Open Andrew-Drew opened 1 day ago

Andrew-Drew commented 1 day ago

Description

After updating to the latest version I've noticed that FileSystem.Current.AppDataDirectory returns a directory located in %LocalAppData% instead of %AppData% for my unpackaged app.

In 8.0.61 the path is: C:\Users\Andrew\AppData\Roaming\[publisher]\[package]\Data

In 8.0.100 the path is: C:\Users\Andrew\AppData\Local\[publisher]\[package]\Data

I've been able to track the change down to PR #23265 and I assume that the change is unintentional as the commit messages and the linked issue only talk about creating the directory if it doesn't exist.

This change doesn't just impact user code. For example the Preferences.Default implementation uses the path returned by FileSystem.Current.AppDataDirectory to create the preferences file. I've noticed this because all my app preferences got reset after updating to version 8.0.100

in 8.0.61 the preferences file for Preferences.Default was stored in: C:\Users\Andrew\AppData\Roaming\[publisher]\[package]\Settings\preferences.dat

and in 8.0.100 it is loaded from: C:\Users\Andrew\AppData\Local\[publisher]\[package]\Settings\preferences.dat

Steps to Reproduce

No response

Link to public reproduction project repository

No response

Version with bug

8.0.100 SR10

Is this a regression from previous behavior?

Yes, this used to work in .NET MAUI

Last version that worked well

8.0.61 SR6.1

Affected platforms

Windows

Affected platform versions

No response

Did you find any workaround?

No response

Relevant log output