-
Notifications
You must be signed in to change notification settings - Fork 222
Description
Describe the bug and how to reproduce
Changed event is not raised after permanent delete (SHIFT+DELETE) of a folder. I tested on Windows 11 with explicitly setting ChangeFilters.FolderDeleted and then AllDiskEvents, and then AllEvents. In all three cases, Changed event is not raised for ChangeType equals to FolderDeleted.
I debugged ShellItemChangeWatcher and see that MessageFilter of WatcherNativeWindow is not called with correct parameters. I checked the code and MSDN documentation, and everything seems correct.
So, what do you think the problem might be? Where should I check?
What code is involved
ShellItemChangeWatcher shellItemChangeWatcher = new ShellItemChangeWatcher();
shellItemChangeWatcher.NotifyFilter = ChangeFilters.AllDiskEvents;
shellItemChangeWatcher.Changed += ShellItemChangeWatcher_Changed;
void ShellItemChangeWatcher_Changed(object sender, ShellItemChangeWatcher.ShellItemChangeEventArgs e)
{
if (e.ChangedItems.Length > 0)
{
Console.WriteLine($"ShellItemChangeWatcher: {e.ChangeType}: ");
foreach (var item in e.ChangedItems)
{
Console.WriteLine($"{item}");
}
}
}
shellItemChangeWatcher.Item = ShellFolder.Desktop;
shellItemChangeWatcher.IncludeChildren = true;
shellItemChangeWatcher.EnableRaisingEvents = true;
Expected behavior
After deleting a folder from the file system, Changed event is raised for e.ChangeType equals to FolderDeleted.