This project has moved. For the latest updates, please go here.

How to debug managed shell context menu?

Jan 5, 2011 at 8:44 AM

Hi.

Thank you for MMSF.

After I create a class derived from ContextMenuBase and register it with regasm.exe, how can I debug it?

Should I be able to attach to explorer.exe?

Thank you.

Coordinator
Jan 6, 2011 at 11:12 PM

Yes, just attaching your debugger (I use Visual Studio) to explorer.exe will allow to debug your ContextMenu.

You will also need to kill explorer.exe before being able to make a new build as often explorer.exe locks your DLL (it can take a couple of minutes before COM unloads a DLL when there are no more references to it). I use Process Explorer to kill explorer.exe and start it again, but the standard Windows Task Mananger can do this also.

There are some other ways, but I found this method the most practical as it work on all versions of Windows.

Note: Since Vista (and improved in Win7) simple ContextMenu's can also be created by just some registry entries:
http://msdn.microsoft.com/en-us/library/cc144171(v=vs.85).aspx (I had no time to add this info to this codeplex site yet).

 

 

Jan 19, 2011 at 7:32 AM

Thank you; it works!

I found an msdn article here that explains some tricks to help debug shell and namespace extension dlls so we don't have to kill explorer.exe every time:

Debugging with the Shell
http://msdn.microsoft.com/en-us/library/cc144064.aspx

Hope that helps! :)