Case of frozen File Explorer
Some time ago I started to get strange freezes when I try to open File Explorer. New File Explorer appears on screen, renders left and top part and then displays “Working on it…” where files supposed to be and then nothing. And today I would like to share my discoveries.
Obviously, first thing I tried to kill File Explorer and start over. Exactly the same behavior. I rarely use File Explorer because I prefer FAR file manager. But sometimes I do use File Explorer, mostly to copy files via Remote Desktop. In this particular case I decided to start FAR file manager to check something. And to my surprise, exactly the same happens to FAR. These two programs have pretty much nothing in common. FAR is console application and in many cases, it will still work when GUI application stopped working. I had few of these cases when I was messing with Microsoft Spy application.
And after I was thinking what to do, after about 5 minutes everything came back to normal. Then it happened again. And I decided that I have to dig deeper. I waited until next time it happened and take dump file for File Explorer and FAR in Task Manager. Taking dump file is very simple: Open Task Manager, go to Details tab, find necessary process, right click on it and select Create Dump File. After some time, Windows will create dump file and display message with path to that dump file.
Then I opened dump of File Explorer in WinDbg. There were 24 threads and to be honest I did not see anything interesting. Then I opened dump of FAR and I immediately saw something interesting there. Here is how call stack of main thread looks:
ntdll!NtWaitForMultipleObjects KERNELBASE!WaitForMultipleObjectsEx PortableDeviceApi!CWudfDriverChannel::WaitForWpdMessageResults PortableDeviceApi!CPortableDevice::SendCommand PortableDeviceApi!BaseHelpers::SendCommand PortableDeviceApi!BaseHelpers::SendCommand PortableDeviceApi!BaseHelpers::GetSupportedCommands PortableDeviceApi!CPortableDevice::Content PortaDev PortaDev!SetStartupInfoW Far Far
As you can see FAR stuck somewhere in PortableDeviceApi!CWudfDriverChannel::WaitForWpdMessageResults. It looks like it sent some command to portable device and waiting for result. Interesting. Then I decided to check File Explorer again to see if that one appears in call stack. And I found pretty much the same call stack in thread #23:
ntdll!NtWaitForMultipleObjects KERNELBASE!WaitForMultipleObjectsEx PortableDeviceApi!CWudfDriverChannel::WaitForWpdMessageResults PortableDeviceApi!CPortableDevice::SendCommand PortableDeviceApi!DeviceInfo::PopulateValues PortableDeviceApi!DeviceInfo::SendEvent PortableDeviceApi!CPortableDevice::Open wpdshext!GlobalInterfaceThreadProc kernel32!BaseThreadInitThunk ntdll!RtlUserThreadStart
Then I started to think why Windows stuck there. And while I was thinking, I saw my old iPad 2 under my computer case, that was plugged to computer to charge. It is portable device! I unplugged it and miracle happened: File Explorer immediately unfreeze as well as FAR manager. Nice! I plugged it back and still everything working.
To be honest, I have no idea why iPad does not respond sometimes. It is almost 10 years old, there were no iOS updates for it for quite some time. So, it could be outdated iPad. Or perhaps cable is broken. My iPhone is also always plugged in, but I never had this problem with connected iPhone. But now I know what to do in this case and I moved on.
I hope it helps someone.