If you have coded many add-ins or a complex add-in, chances are that you have encountered the dreaded System.ArgumentException “Value does not fall within the expected range.” when adding commands, buttons, commandbars, etc. Most of the AddXXX methods of the automation model receive so many parameters (many ones optional) that one little mistake and you get that exception. The problem is that you can’t know where is the little mistake because you aren’t provided the offending parameter and a hint of the problem.
I have filed a suggestion to Microsoft to make our debugging time easier:
Provide better error information in automation model (EnvDTE) for add-ins
You can vote for it if you hate to waste your time guessing…