{"record":{"id":"a1e031ad0d2af3ac","repo":"files-community/Files","slug":"specified-method-is-not-supported","errorCode":null,"errorMessage":"Specified method is not supported.","messagePattern":"Specified method is not supported\\.","errorType":"exception","errorClass":"NotSupportedException","httpStatus":null,"severity":"warning","filePath":"src/Files.App/Utils/Storage/StorageItems/VirtualStorageFolder.cs","lineNumber":106,"sourceCode":"\t\tpublic override IAsyncOperation<BaseStorageFolder> CreateFolderAsync(string desiredName, CreationCollisionOption options)\n\t\t\t=> throw new NotSupportedException();\n\t\tpublic override IAsyncOperation<BaseStorageFolder> MoveAsync(IStorageFolder destinationFolder) => throw new NotSupportedException();\n\t\tpublic override IAsyncOperation<BaseStorageFolder> MoveAsync(IStorageFolder destinationFolder, NameCollisionOption option) => throw new NotSupportedException();\n\n\t\tpublic override IAsyncAction RenameAsync(string desiredName)\n\t\t\t=> RenameAsync(desiredName, NameCollisionOption.FailIfExists);\n\t\tpublic override IAsyncAction RenameAsync(string desiredName, NameCollisionOption option)\n\t\t\t=> throw new NotSupportedException();\n\n\t\tpublic override IAsyncAction DeleteAsync()\n\t\t\t=> throw new NotSupportedException();\n\t\tpublic override IAsyncAction DeleteAsync(StorageDeleteOption option) => DeleteAsync();\n\n\t\tpublic override bool AreQueryOptionsSupported(QueryOptions queryOptions) => false;\n\t\tpublic override bool IsCommonFileQuerySupported(CommonFileQuery query) => false;\n\t\tpublic override bool IsCommonFolderQuerySupported(CommonFolderQuery query) => false;\n\n\t\tpublic override StorageItemQueryResult CreateItemQuery() => throw new NotSupportedException();\n\t\tpublic override BaseStorageItemQueryResult CreateItemQueryWithOptions(QueryOptions queryOptions) => new(this, queryOptions);\n\n\t\tpublic override StorageFileQueryResult CreateFileQuery() => throw new NotSupportedException();\n\t\tpublic override StorageFileQueryResult CreateFileQuery(CommonFileQuery query) => throw new NotSupportedException();\n\t\tpublic override BaseStorageFileQueryResult CreateFileQueryWithOptions(QueryOptions queryOptions) => new(this, queryOptions);\n\n\t\tpublic override StorageFolderQueryResult CreateFolderQuery() => throw new NotSupportedException();\n\t\tpublic override StorageFolderQueryResult CreateFolderQuery(CommonFolderQuery query) => throw new NotSupportedException();\n\t\tpublic override BaseStorageFolderQueryResult CreateFolderQueryWithOptions(QueryOptions queryOptions) => new(this, queryOptions);\n\n\t\tpublic override IAsyncOperation<StorageItemThumbnail> GetThumbnailAsync(ThumbnailMode mode)\n\t\t\t=> Task.FromResult<StorageItemThumbnail>(null).AsAsyncOperation();\n\t\tpublic override IAsyncOperation<StorageItemThumbnail> GetThumbnailAsync(ThumbnailMode mode, uint requestedSize)\n\t\t\t=> Task.FromResult<StorageItemThumbnail>(null).AsAsyncOperation();\n\t\tpublic override IAsyncOperation<StorageItemThumbnail> GetThumbnailAsync(ThumbnailMode mode, uint requestedSize, ThumbnailOptions options)\n\t\t\t=> Task.FromResult<StorageItemThumbnail>(null).AsAsyncOperation();\n\t}\n}","sourceCodeStart":88,"sourceCodeEnd":124,"githubUrl":"https://github.com/files-community/Files/blob/68c68a58d4d6a5f7197e07c8fff85cfd4279c78b/src/Files.App/Utils/Storage/StorageItems/VirtualStorageFolder.cs#L88-L124","documentation":"Thrown by VirtualStorageFolder.CreateItemQuery as NotSupportedException. VirtualStorageFolder is a lightweight, in-memory BaseStorageFolder that does not back a real Windows.Storage query. It does not implement the legacy StorageItemQueryResult surface; only the 'WithOptions' variant is supported (it returns a BaseStorageItemQueryResult).","triggerScenarios":"Calling CreateItemQuery() on any VirtualStorageFolder instance. This happens when code requests the non-options query API, e.g. older WinRT-style enumeration or a consumer that does not use CreateItemQueryWithOptions.","commonSituations":"Third-party or legacy code calling the plain CreateItemQuery; search/indexing features that fall back to the parameterless query; generic algorithms that enumerate all query-creation entry points.","solutions":["Use CreateItemQueryWithOptions(queryOptions) instead, which is supported and returns a BaseStorageItemQueryResult.","Check the folder type before calling; for VirtualStorageFolder, prefer GetItemsAsync directly.","Catch NotSupportedException and fall back to the WithOptions overload or direct enumeration.","If you must support the plain query, subclass VirtualStorageFolder and override CreateItemQuery to build a result over GetItemsAsync."],"exampleFix":"// before\nvar query = folder.CreateItemQuery();\n\n// after\nvar query = folder.CreateItemQueryWithOptions(new QueryOptions());\n// or enumerate directly\nvar items = await folder.GetItemsAsync();","handlingStrategy":"validation","validationCode":"// Prefer the supported WithOptions query over the plain query.\nBaseStorageItemQueryResult result =\n    folder is VirtualStorageFolder\n        ? folder.CreateItemQueryWithOptions(new QueryOptions())\n        : folder.CreateItemQuery();","typeGuard":"static bool SupportsPlainItemQuery(BaseStorageFolder f) => f is not VirtualStorageFolder;","tryCatchPattern":"try { var q = folder.CreateItemQuery(); }\ncatch (NotSupportedException) { var q = folder.CreateItemQueryWithOptions(new QueryOptions()); }","preventionTips":["Use CreateItemQueryWithOptions for virtual folders.","Guard with a type check before calling the plain query.","Fall back to GetItemsAsync for direct enumeration."],"tags":["storage","virtual-items","query","notsupported"],"backgroundTag":null,"analyzedSha":"68c68a58d4d6a5f7197e07c8fff85cfd4279c78b","analyzedAt":"2026-08-13T10:34:54.614Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}