I'm programming an app in WinUi3 base on .net 6.0 and when I use this (very) simple snippet :
Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\StockManagerScanner";
Directory.CreateDirectory(appdataPath);
visual studio return me the correct path from Environment.GetFolderPath()
-> "C:\Users\thoma\AppData\Local\StockManagerScanner"
When I try to find in file explorer if the folder has been successfully created I found that the new folder doesn't exist at this location. To find it I use Everything software and it seems that the folder has been created in :
-> C:\Users\thoma\AppData\Local\Packages\828b881a-bd9e-48d1-a946-40dba3e0f957_gkx4qx1bgg8j8\LocalCache\Local\StockManagerScanner
I use the same snippets in a console app based on .net framework 4.8 and it create the folder at the right place !
Why does my app in winui3 do that and not act like it should ?
EDIT :
This snippet create the folder StockManagerScanner in the wierd location too...
string appdataPath = $"C:\\Users\\{Environment.UserName}\\AppData\\Local\\StockManagerScanner";
Directory.CreateDirectory(appdataPath);