files-community/Files · error · NotImplementedException
The method or operation is not implemented.
Error message
The method or operation is not implemented.
What it means
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.
Source
Thrown at src/Files.App/Utils/Storage/StorageItems/VirtualStorageItem.cs:103
private async void StreamedFileWriterAsync(StreamedFileDataRequest request)
{
try
{
await using (var stream = request.AsStreamForWrite())
{
await stream.FlushAsync();
}
request.Dispose();
}
catch (Exception)
{
request.FailAndClose(StreamedFileFailureMode.Incomplete);
}
}
public IAsyncAction RenameAsync(string desiredName)
{
throw new NotImplementedException();
}
public IAsyncAction RenameAsync(string desiredName, NameCollisionOption option)
{
throw new NotImplementedException();
}
public IAsyncAction DeleteAsync()
{
throw new NotImplementedException();
}
public IAsyncAction DeleteAsync(StorageDeleteOption option)
{
throw new NotImplementedException();
}
public IAsyncOperation<BasicProperties> GetBasicPropertiesAsync()View on GitHub (pinned to 68c68a58d4)
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.
Example fix
// before
IStorageItem item = VirtualStorageItem.FromListedItem(listedItem);
await item.RenameAsync("newname.txt"); // throws NotImplementedException
// after
if (item is VirtualStorageItem)
{
var real = await BaseStorageFile.GetFileFromPathAsync(item.Path);
await real.RenameAsync("newname.txt");
}
else
{
await item.RenameAsync("newname.txt");
} Defensive patterns
Strategy: type-guard
Validate before calling
bool CanRename(IStorageItem item) => item is not VirtualStorageItem;
Type guard
static bool IsVirtual(IStorageItem item) => item is VirtualStorageItem;
Try / catch
// Avoid calling RenameAsync on VirtualStorageItem; if unavoidable:
try { await item.RenameAsync(name); }
catch (NotImplementedException) when (item is VirtualStorageItem) { /* resolve real file and retry */ } Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Specified method is not supported.
- Can't open zip file as RW
- Moving to recycle bin is not supported.
- Specified method is not supported.
- Moving to recycle bin is not supported.
AI-assisted analysis of files-community/Files@68c68a58d4 (2026-08-13).
Data as JSON: /api/errors/edaf8f7fdc19949f.
Report an issue: GitHub.