I just run into this issue. I have a contextual RibbonTab and I reconfigure it (hiding/showing panels) just before setting RibbonTab.Context.Visible to true. The code runs into an infinite loop when trying to resize the panels to fit in its tab.
I could break the infinite loop with the following modifications in RibbonTab.cs file:
private bool AllPanelsOverflow()
foreach (RibbonPanel panel in Panels)
if (panel.Visible && panel.SizeMode != RibbonElementSizeMode.Overflow)