Support Statement: Dealing with name clashes in COM stub classes

One of the common build errors we encounter is the following:

<!--
VBP: BayerTC.vbp
ERRNUM: CS0102: The type 'TrueOleDBGrid70.TDBGrid' already contains a definition for 'FetchRowStyle'
NETSRC: C:\gmClients\AmerisourceBergen\proj\deploy\BayerTC_std_csh\externs\TrueOleDBGrid70.cs@986
public event TrueDBGridEvents_FetchRowStyleEventHandler FetchRowStyle;
-->

This occurs when a COM API has a naming collision between two members in a given class.

Most frequently, one of the two members is an event because in COM, the inbound interface (i.e., event handlers) are in a different class from the outbound interface (i.e., automation) so there was no clash. But when we merge these two interfaces into a stub class, we get a clash.

The typical fix is to find the clashing handler and change the netName attribute by adding "Event", like this:

 

1
2
3
<event id="FetchRowStyle" netName="FetchRowStyleEvent" <--- changed
 
netHandler="AxTrueOleDBGrid70.TrueDBGridEvents_FetchRowStyleEventHandler" netArgs="AxTrueOleDBGrid70.TrueDBGridEvents_FetchRowStyleEvent">

 

I propose that either the IDF generator or the stub generator detect and prevent these clashes.