runtime: LocalApplicationData path does not get created

Description

I have an application created from .NET MAUI Blazor App template.

When creating directory inside LocalApplicationData path, it returns success but there is no actually directory created. The first time code from Steps to Reproduce runs it will create the directory and any consecutive time Directory.Exists will return true, yet when application tries to open that newly created directory or when you browse to that path in File Explorer, it’s not there.

This affects Windows and Android. I have not tested with iOS.

Steps to Reproduce

string path = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "MyApp1");

if (!Directory.Exists(path))
{
	DirectoryInfo dir = Directory.CreateDirectory(path);
}

Version with bug

Preview 14 (current)

Last version that worked well

Unknown/Other

Affected platforms

Android, Windows

Affected platform versions

Windows SDK 10.0.19041, Android 11.0

Did you find any workaround?

Replacing LocalApplicationData with CommonApplicationData works on Windows, but fails on Android with error: System.IO.IOException: ‘Read-only file system : ‘/usr/share/MyApp1’’

Relevant log output

No response

About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Reactions: 1
  • Comments: 24 (15 by maintainers)

Most upvoted comments

We’d welcome a PR if you want to clarify docs (look for pencil icon button on the doc page)

@jeffhandley since this appears to be windows specific, can you please assign to right person?