files-community/Files · error · NotSupportedException
Specified method is not supported.
Error message
Specified method is not supported.
What it means
ZipStorageFolder.ToStorageFolderAsync throws NotSupportedException. ToStorageFolderAsync on BaseStorageFolder is meant to project the custom storage folder into a real Windows.Storage.StorageFolder. A zip-backed folder has no equivalent OS StorageFolder (the archive is a file, not a real directory), so the conversion cannot be performed and is declared unsupported.
Source
Thrown at src/Files.App/Utils/Storage/StorageItems/ZipStorageFolder.cs:174
};
var ext = IO.Path.GetExtension(filePath)?.ToLowerInvariant();
return await defaultAppDict.GetAsync(ext ?? "", queryFileAssoc);
}
public static IAsyncOperation<BaseStorageFolder> FromPathAsync(string path)
{
var containerPath = GetContainerPath(path);
if (containerPath is not null && CheckAccess(containerPath))
{
return Task.FromResult((BaseStorageFolder)new ZipStorageFolder(path, containerPath)).AsAsyncOperation();
}
return Task.FromResult<BaseStorageFolder>(null).AsAsyncOperation();
}
public static IAsyncOperation<BaseStorageFolder> FromStorageFileAsync(BaseStorageFile file)
=> AsyncInfo.Run<BaseStorageFolder>(async (cancellationToken) => await CheckAccess(file) ? new ZipStorageFolder(file) : null);
public override IAsyncOperation<StorageFolder> ToStorageFolderAsync() => throw new NotSupportedException();
public override bool IsEqual(IStorageItem item) => item?.Path == Path;
public override bool IsOfType(StorageItemTypes type) => type == StorageItemTypes.Folder;
public override IAsyncOperation<IndexedState> GetIndexedStateAsync() => Task.FromResult(IndexedState.NotIndexed).AsAsyncOperation();
public override IAsyncOperation<BaseStorageFolder> GetParentAsync() => throw new NotSupportedException();
private async Task<BaseBasicProperties> GetBasicProperties()
{
using SevenZipExtractor zipFile = await OpenZipFileAsync();
if (zipFile is null || zipFile.ArchiveFileData is null)
{
return new BaseBasicProperties();
}
//zipFile.IsStreamOwner = true;
var entry = zipFile.GetArchiveFileData(containerPath).FirstOrDefault(x => System.IO.Path.Combine(containerPath, x.FileName) == Path);
return entry.FileName is nullView on GitHub (pinned to 68c68a58d4)
Solutions
- Do not call ToStorageFolderAsync on a ZipStorageFolder; keep operating through BaseStorageFolder.
- If a native StorageFolder is required, extract the archive to a real temp directory and use StorageFolder.GetFolderFromPathAsync on that.
- Type-check and reject the conversion for zip-backed folders.
Example fix
// before var native = await zipFolder.ToStorageFolderAsync(); // throws // after // operate via BaseStorageFolder APIs only var items = await zipFolder.GetItemsAsync();
Defensive patterns
Strategy: validation
Validate before calling
bool CanConvertToNative(BaseStorageFolder f) => f is not ZipStorageFolder;
Type guard
static bool IsZipBacked(BaseStorageFolder f) => f is ZipStorageFolder;
Try / catch
try { return await f.ToStorageFolderAsync(); }
catch (NotSupportedException) { /* operate via BaseStorageFolder APIs */ } Prevention
- Never call ToStorageFolderAsync on zip folders.
- Keep using BaseStorageFolder methods for zip interiors.
- Extract to a temp directory if a native StorageFolder is required.
When it happens
Trigger: Calling ToStorageFolderAsync() on a ZipStorageFolder (root or inner entry folder). Typical source: a component that requires a native StorageFolder (e.g. a picker or a shell-bound API) and tries to convert whatever BaseStorageFolder it received.
Common situations: Third-party or framework code that calls AsStorageFolder()/ToStorageFolderAsync() to obtain a native StorageFolder for a folder broker that is actually a zip interior.
Related errors
- Specified method is not supported.
- Can't open zip file as RW
- Moving to recycle bin is not supported.
- Moving to recycle bin is not supported.
- The method or operation is not implemented.
AI-assisted analysis of files-community/Files@68c68a58d4 (2026-08-13).
Data as JSON: /api/errors/d0fdb9a7644fe13c.
Report an issue: GitHub.