First of all, I must say that I was unaware of this rule for many years, and that is probably because I started programming Visio in VBA back in the mid ’90s. VBA is built in to Visio like other Microsoft Office applications, and as such, it has a direct uninterrupted access to the Visio Api. It is very chatty by nature, and has immediate access to all the events in the Visio Api. Therefore there is little extra cost in using multiple nested reference to Visio objects, however VSTO Addins do not have this luxury, and the C# code gets access via the .Net Framework. This is an extra layer that calls to the Visio Api need to go through, and these calls need to cross the COM boundary multiple times if the they are chained together with more than 2-dots. So what does that mean in practice? Well, every crossing of this boundary takes time, and it all adds up. So, I asked AI to explain more about the importance of abiding by the 2-dot rule….

















