When the application is unloaded, you need to remove any commands that were added at initialization. In addition, you should remove your protocol extension class from the ObjectARX class dictionary and delete the class descriptor object for your protocol extension class.