According to the documentation, calls to System.Environment.GetFolderPath can fail with PlatformNotSupportedException:
try
{
var appData = System.Environment.SpecialFolder.ApplicationData;
var folder = System.Environment.GetFolderPath(appData);
// Read/write files in ApplicationData
}
catch (System.PlatformNotSupportedException ex)
{
System.Console.WriteLine("Environment paths not supported: " + ex.Message);
// Does this ever actually happen?
}
Unfortunately, the official documentation doesn't list supported or unsupported platforms.
Searching in the .net core sources reveals references to Windows.Storage calls (e.g. UserDataPaths.GetDefault(), AppDataPaths.GetDefault(), ApplicationData.RoamingFolder property), System.Runtime.InteropServices calls, and Interop.Shell32.KnownFolders calls. None of these are marked as throwing a PlatformNotSupportedException.
Are there any known platforms that can actually trigger this exception? If so, which ones?