Was getting this error all day:
System.NullReferenceException: Object reference not set to an instance of an object. at Microsoft.Web.CommandUI.RibbonRenderer.AllGroupsControlsTrimmed(DataNode xn, RibbonRenderContext rrc)
And finally came across someone with an answer — you have to remove ALL COMMENTS from your CommandUIDefinition and CommandUIHandler
Never would have thought of that – hopefully helps someone else (or possibly Future Rich).