{"record":{"id":"3c152c95a0a56875","repo":"files-community/Files","slug":"specified-method-is-not-supported-3c152c","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/ZipStorageFile.cs","lineNumber":100,"sourceCode":"\t\t\t\treturn Task.FromResult<BaseStorageFile>(null).AsAsyncOperation();\n\n\t\t\tif (path == containerPath)\n\t\t\t\treturn Task.FromResult<BaseStorageFile>(null).AsAsyncOperation(); // Root\n\n\t\t\tif (CheckAccess(containerPath))\n\t\t\t{\n\t\t\t\tvar file = new ZipStorageFile(path, containerPath);\n\t\t\t\tif (ZipStorageFolder.TryGetEncodingForContainerPath(containerPath, out var encoding))\n\t\t\t\t\tfile.CurrentEncoding = encoding;\n\t\t\t\treturn Task.FromResult<BaseStorageFile>(file).AsAsyncOperation();\n\t\t\t}\n\t\t\treturn Task.FromResult<BaseStorageFile>(null).AsAsyncOperation();\n\t\t}\n\n\t\tpublic override bool IsEqual(IStorageItem item) => item?.Path == Path;\n\t\tpublic override bool IsOfType(StorageItemTypes type) => type is StorageItemTypes.File;\n\n\t\tpublic override IAsyncOperation<BaseStorageFolder> GetParentAsync() => throw new NotSupportedException();\n\t\tpublic override IAsyncOperation<BaseBasicProperties> GetBasicPropertiesAsync()\n\t\t{\n\t\t\treturn AsyncInfo.Run(async (cancellationToken) =>\n\t\t\t{\n\t\t\t\tif (CurrentEncoding is not null && Path != containerPath)\n\t\t\t\t\treturn await GetBasicPropertiesWithEncodingAsync();\n\n\t\t\t\treturn await GetBasicProperties();\n\t\t\t});\n\t\t}\n\n\t\tpublic override IAsyncOperation<IRandomAccessStream> OpenAsync(FileAccessMode accessMode)\n\t\t{\n\t\t\tif (CurrentEncoding is not null && Path != containerPath)\n\t\t\t\treturn OpenWithEncodingAsync(accessMode);\n\n\t\t\treturn AsyncInfo.Run((cancellationToken) => SafetyExtensions.Wrap<IRandomAccessStream>(async () =>\n\t\t\t{","sourceCodeStart":82,"sourceCodeEnd":118,"githubUrl":"https://github.com/files-community/Files/blob/68c68a58d4d6a5f7197e07c8fff85cfd4279c78b/src/Files.App/Utils/Storage/StorageItems/ZipStorageFile.cs#L82-L118","documentation":"ZipStorageFile overrides BaseStorageFile.GetParentAsync to throw NotSupportedException. A file inside a ZIP archive has no single real WinRT parent folder object the implementation can return, so the operation is unsupported rather than unimplemented. The root archive container and inner entries alike return this failure.","triggerScenarios":"Calling GetParentAsync() on a ZipStorageFile (either the archive root or a file entry inside it). For example, code that walks up the directory tree via GetParentAsync to compute ancestry or to navigate to the containing folder.","commonSituations":"Breadcrumb/up-navigation logic, or any generic folder-tree traversal that assumes every IStorageItem has a resolvable parent, when the current item is a zip-backed file.","solutions":["Before calling GetParentAsync, check whether the item is a ZipStorageFile/ZipStorageFolder; if so, compute the parent path string directly instead of using the async API.","Derive the parent from item.Path (strip the last path segment) rather than asking the storage object.","Catch NotSupportedException and fall back to a path-based parent computation."],"exampleFix":"// before\nvar parent = await zipFile.GetParentAsync(); // throws\n\n// after\nvar parentPath = System.IO.Path.GetDirectoryName(zipFile.Path);\nvar parent = string.IsNullOrEmpty(parentPath) ? null : await BaseStorageFolder.GetFolderFromPathAsync(parentPath);","handlingStrategy":"validation","validationCode":"static bool HasParentAsync(IStorageFile f) => f is not ZipStorageFile;","typeGuard":"static bool IsZipBacked(IStorageItem item) => item is ZipStorageFile or ZipStorageFolder;","tryCatchPattern":"try { return await file.GetParentAsync(); }\ncatch (NotSupportedException) { /* compute parent from Path */ }","preventionTips":["For zip-backed items, derive the parent from the Path string.","Avoid GetParentAsync on ZipStorage* types.","Use breadcrumb/path-based navigation for items inside archives."],"tags":["winrt","storage","zip","not-supported","parent"],"backgroundTag":null,"analyzedSha":"68c68a58d4d6a5f7197e07c8fff85cfd4279c78b","analyzedAt":"2026-08-13T10:34:54.614Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}