GraphicsCapturePicker breaks Windows Explorer after display is unplugged
System Info: Windows 10 Pro x64 10.0.19041 running on Lenovo L540 Visusal Studio 2019 V16.8.2 Windows SDK: 10.0.19041.0 Platform Toolset: VS 2019 (v142) Microsoft.Windows.CppWinRT nuget package v2.0.201217.4
Laptop has 2 external displays plugged in.
Repro Steps:
- Get and build Win32CaptureSample-master
- Start the app and press "Open Picker" to show the GraphicsCapturePicker popup
- Unplug one of the external displays
- Press cancel on the GraphicsCapturePicker popup
At this point Windows Explorer is in a bad state. Clicking Windows Icon in the task bar does not bring up the start menu. Right clicking any of the app icons in the task bar does not bring up the context menu. Clicking the "Open Picker" button on the Win32CaptureSample app brings up the GraphicsCapturePicker but with no content (see attached image). It was necessary to restart Windows Explorer from the Task Manager in order to recover.
Running the same steps as above with only 1 external display will result in Win32CaptureSample throwing an exception when the display is unplugged (see attached image)

.
Thanks for reporting this!
Hmmm... I'm not able to reproduce this with my Surface Laptop. There is a problem, the application crashes for me, but it doesn't leave explorer in a bad state. I haven't attached a debugger yet, that might yield more answers.
MonitorList has a pretty silly bug in it... but it's not something that should put Explorer in a bad state. I'll fix that issue first and we'll see if the other issue manifests.
I think I can reproduce the original issue, I'll need to do some debugging to see if it's actually related. I'm not sure what I saw before, but I can't see the bug in MonitorList that I was convinced of.