I have implemented the right click context menu for Win 11 using the IExplorerCommands and sparse package combination for handling the app identity in C++. All works well but I have one strange issue that I am trying to figure out. Sparse package registration, App identity and context menu part works as expected unless you do the following:
When I do a right click on any folder or item inside the Explorer, the context menu is displayed properly and backend methods receive the IShellItemArray* psiItemArray containing proper metadata about the selected folder or file. This is the expected behavior that works most of the time.
Strange thing happens when you start doing right clicks on items in the Navigation Pane (the left side of the File Explorer). When there is no previously selected file or folder in the Explorer and you right click on ANY item in the Navigation pane, the backend events do not fire until you do additional mouse move and when the events come, the IShellItemArray* psiItemArray is NULL -> no metadata about the item that was right clicked come!
When you previously selected a file or folder in the Explorer and you do then a right click on ANY item in the Navigation pane, the backend event comes with wrong metadata, the IShellItemArray* psiItemArray contains metadata of the item that was previously selected and not the item that was currently right clicked in the Navigation Pane. This causes strange behavior when showing the context menus.
Also, when you do direct registry entries (the old way of using IExplorerCommand context menu), the events are coming to the backend properly with proper metadata BUT the win11 context menu does not show up as expected because it was not triggered by the sparse package - it does show up when you click on the "show more options" part that shows the old context menu though.
Is this a Win11 context menu bug or am I missing something?