{"record":{"id":"d0fdb9a7644fe13c","repo":"files-community/Files","slug":"specified-method-is-not-supported-d0fdb9","errorCode":null,"errorMessage":"Specified method is not supported.","messagePattern":"Specified method is not supported\\.","errorType":"exception","errorClass":"NotSupportedException","httpStatus":null,"severity":"error","filePath":"src/Files.App/Utils/Storage/StorageItems/ZipStorageFolder.cs","lineNumber":174,"sourceCode":"\t\t\t};\n\t\t\tvar ext = IO.Path.GetExtension(filePath)?.ToLowerInvariant();\n\t\t\treturn await defaultAppDict.GetAsync(ext ?? \"\", queryFileAssoc);\n\t\t}\n\n\t\tpublic static IAsyncOperation<BaseStorageFolder> FromPathAsync(string path)\n\t\t{\n\t\t\tvar containerPath = GetContainerPath(path);\n\t\t\tif (containerPath is not null && CheckAccess(containerPath))\n\t\t\t{\n\t\t\t\treturn Task.FromResult((BaseStorageFolder)new ZipStorageFolder(path, containerPath)).AsAsyncOperation();\n\t\t\t}\n\t\t\treturn Task.FromResult<BaseStorageFolder>(null).AsAsyncOperation();\n\t\t}\n\n\t\tpublic static IAsyncOperation<BaseStorageFolder> FromStorageFileAsync(BaseStorageFile file)\n\t\t\t=> AsyncInfo.Run<BaseStorageFolder>(async (cancellationToken) => await CheckAccess(file) ? new ZipStorageFolder(file) : null);\n\n\t\tpublic override IAsyncOperation<StorageFolder> ToStorageFolderAsync() => throw new NotSupportedException();\n\n\t\tpublic override bool IsEqual(IStorageItem item) => item?.Path == Path;\n\t\tpublic override bool IsOfType(StorageItemTypes type) => type == StorageItemTypes.Folder;\n\n\t\tpublic override IAsyncOperation<IndexedState> GetIndexedStateAsync() => Task.FromResult(IndexedState.NotIndexed).AsAsyncOperation();\n\n\t\tpublic override IAsyncOperation<BaseStorageFolder> GetParentAsync() => throw new NotSupportedException();\n\n\t\tprivate async Task<BaseBasicProperties> GetBasicProperties()\n\t\t{\n\t\t\tusing SevenZipExtractor zipFile = await OpenZipFileAsync();\n\t\t\tif (zipFile is null || zipFile.ArchiveFileData is null)\n\t\t\t{\n\t\t\t\treturn new BaseBasicProperties();\n\t\t\t}\n\t\t\t//zipFile.IsStreamOwner = true;\n\t\t\tvar entry = zipFile.GetArchiveFileData(containerPath).FirstOrDefault(x => System.IO.Path.Combine(containerPath, x.FileName) == Path);\n\t\t\treturn entry.FileName is null","sourceCodeStart":156,"sourceCodeEnd":192,"githubUrl":"https://github.com/files-community/Files/blob/68c68a58d4d6a5f7197e07c8fff85cfd4279c78b/src/Files.App/Utils/Storage/StorageItems/ZipStorageFolder.cs#L156-L192","documentation":"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.","triggerScenarios":"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.","commonSituations":"Third-party or framework code that calls AsStorageFolder()/ToStorageFolderAsync() to obtain a native StorageFolder for a folder broker that is actually a zip interior.","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."],"exampleFix":"// before\nvar native = await zipFolder.ToStorageFolderAsync(); // throws\n\n// after\n// operate via BaseStorageFolder APIs only\nvar items = await zipFolder.GetItemsAsync();","handlingStrategy":"validation","validationCode":"bool CanConvertToNative(BaseStorageFolder f) => f is not ZipStorageFolder;","typeGuard":"static bool IsZipBacked(BaseStorageFolder f) => f is ZipStorageFolder;","tryCatchPattern":"try { return await f.ToStorageFolderAsync(); }\ncatch (NotSupportedException) { /* operate via BaseStorageFolder APIs */ }","preventionTips":["Never call ToStorageFolderAsync on zip folders.","Keep using BaseStorageFolder methods for zip interiors.","Extract to a temp directory if a native StorageFolder is required."],"tags":["winrt","storage","zip","folder-conversion","not-supported"],"backgroundTag":null,"analyzedSha":"68c68a58d4d6a5f7197e07c8fff85cfd4279c78b","analyzedAt":"2026-08-13T10:34:54.614Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}