Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Andrew-Drew opened this issue Nov 20, 2024 · 2 comments · May be fixed by #26039
Open
Labels
i/regression This issue described a confirmed regression on a currently supported version platform/windows 🪟 t/bug Something isn't working
Milestone

Comments

@Andrew-Drew
Copy link

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

@Andrew-Drew Andrew-Drew added the t/bug Something isn't working label Nov 20, 2024
@samhouts samhouts added platform/windows 🪟 potential-regression This issue described a possible regression on a currently supported version., verification pending labels Nov 20, 2024
@MartyIX
Copy link
Contributor

MartyIX commented Nov 21, 2024

@Andrew-Drew I created #26039. Perhaps you might have a moment to check it out.

edit: You are right that the change was not intentional.

@Andrew-Drew
Copy link
Author

@Andrew-Drew I created #26039. Perhaps you might have a moment to check it out.

LGTM, thank you :)

@PureWeen PureWeen added i/regression This issue described a confirmed regression on a currently supported version and removed potential-regression This issue described a possible regression on a currently supported version., verification pending labels Nov 21, 2024
@PureWeen PureWeen added this to the .NET 9 SR2 milestone Nov 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
i/regression This issue described a confirmed regression on a currently supported version platform/windows 🪟 t/bug Something isn't working
Projects
Status: Todo
4 participants