{"record":{"id":"edaf8f7fdc19949f","repo":"files-community/Files","slug":"the-method-or-operation-is-not-implemented","errorCode":null,"errorMessage":"The method or operation is not implemented.","messagePattern":"The method or operation is not implemented\\.","errorType":"exception","errorClass":"NotImplementedException","httpStatus":null,"severity":"error","filePath":"src/Files.App/Utils/Storage/StorageItems/VirtualStorageItem.cs","lineNumber":103,"sourceCode":"\t\tprivate async void StreamedFileWriterAsync(StreamedFileDataRequest request)\n\t\t{\n\t\t\ttry\n\t\t\t{\n\t\t\t\tawait using (var stream = request.AsStreamForWrite())\n\t\t\t\t{\n\t\t\t\t\tawait stream.FlushAsync();\n\t\t\t\t}\n\t\t\t\trequest.Dispose();\n\t\t\t}\n\t\t\tcatch (Exception)\n\t\t\t{\n\t\t\t\trequest.FailAndClose(StreamedFileFailureMode.Incomplete);\n\t\t\t}\n\t\t}\n\n\t\tpublic IAsyncAction RenameAsync(string desiredName)\n\t\t{\n\t\t\tthrow new NotImplementedException();\n\t\t}\n\n\t\tpublic IAsyncAction RenameAsync(string desiredName, NameCollisionOption option)\n\t\t{\n\t\t\tthrow new NotImplementedException();\n\t\t}\n\n\t\tpublic IAsyncAction DeleteAsync()\n\t\t{\n\t\t\tthrow new NotImplementedException();\n\t\t}\n\n\t\tpublic IAsyncAction DeleteAsync(StorageDeleteOption option)\n\t\t{\n\t\t\tthrow new NotImplementedException();\n\t\t}\n\n\t\tpublic IAsyncOperation<BasicProperties> GetBasicPropertiesAsync()","sourceCodeStart":85,"sourceCodeEnd":121,"githubUrl":"https://github.com/files-community/Files/blob/68c68a58d4d6a5f7197e07c8fff85cfd4279c78b/src/Files.App/Utils/Storage/StorageItems/VirtualStorageItem.cs#L85-L121","documentation":"VirtualStorageItem implements Windows.Storage.IStorageItem only to expose metadata (Name, Path, DateCreated, Attributes) for a ListedItem. It is a read-only facade, so RenameAsync(string) throws NotImplementedException because the class deliberately holds no backing file handle and cannot rename anything. The WinRT IStorageItem contract forces the method to exist, so it is stubbed to fail loudly rather than no-op silently.","triggerScenarios":"Any caller that treats the VirtualStorageItem as a general-purpose IStorageItem and invokes RenameAsync on it. Concretely: code that receives an IStorageItem and unconditionally calls item.RenameAsync(newName), or share/preview/properties dialogs that reuse the IStorageItem for an edit operation.","commonSituations":"Passing a VirtualStorageItem (built via VirtualStorageItem.FromListedItem or FromPath) into a generic storage-operation helper that expects a real StorageFile/BaseStorageFile. Mixing the metadata-only VirtualStorageItem with file-mutation pipelines.","solutions":["Before calling RenameAsync, branch on the concrete type: if the item is VirtualStorageItem, resolve the real storage item first (e.g. await BaseStorageFile.GetFileFromPathAsync(item.Path)) and rename that instead.","Guard the call site with a type check and skip/throw a domain-specific error for virtual items.","Do not pass VirtualStorageItem into rename/move/delete flows; restrict it to read-only metadata consumers."],"exampleFix":"// before\nIStorageItem item = VirtualStorageItem.FromListedItem(listedItem);\nawait item.RenameAsync(\"newname.txt\"); // throws NotImplementedException\n\n// after\nif (item is VirtualStorageItem)\n{\n    var real = await BaseStorageFile.GetFileFromPathAsync(item.Path);\n    await real.RenameAsync(\"newname.txt\");\n}\nelse\n{\n    await item.RenameAsync(\"newname.txt\");\n}","handlingStrategy":"type-guard","validationCode":"bool CanRename(IStorageItem item) => item is not VirtualStorageItem;","typeGuard":"static bool IsVirtual(IStorageItem item) => item is VirtualStorageItem;","tryCatchPattern":"// Avoid calling RenameAsync on VirtualStorageItem; if unavoidable:\ntry { await item.RenameAsync(name); }\ncatch (NotImplementedException) when (item is VirtualStorageItem) { /* resolve real file and retry */ }","preventionTips":["Treat VirtualStorageItem as read-only metadata only.","Resolve a concrete BaseStorageFile/BaseStorageFolder from item.Path before any mutation.","Route mutations through FilesystemHelpers which accepts ListedItem directly."],"tags":["winrt","storage","virtual-item","not-implemented"],"backgroundTag":null,"analyzedSha":"68c68a58d4d6a5f7197e07c8fff85cfd4279c78b","analyzedAt":"2026-08-13T10:34:54.614Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}