Support Statement: Dealing with multiple versions of the same class in IDF

Some IDFs contain multiple versions of the same class.   The tool processes these correctly but when it writes wrappers it only allocates components in multiple coClass to the first coClass. In general, this works well but in this case the code references primarily the ident2 versions and not the ident versions.  The simple fix is to tell the tool to wrap the referenced components into all coClasses that contain them -- but then there are two problems.

First, in this code you might get errors like this:

 

1
Cannot implicitly convert type 'SQLDMO.SQLServer' to 'SQLDMO.SQLServer2'


because within the IDF the ident2 coClasses are not referenced internally only the ident ones. So, when the code uses a component now posted to ident2 that uses type ident, I get errors. This is only a minor problem.  There are relatively few number of these that could be resolved with casts of some sort – but this is MicroSoft and it turns out that MicroSoft loves intertwined class-coclass relationships in all of the commonly-used dlls. The changed conventions cause millions of changes in my tests cases and the build log have many many mostly warnings like:

 

1
2
3
'MSXML2.DOMDocument.parseError' hides inherited member 'MSXML2.IXMLDOMDocument.parseError'.
'ADODB.Connection.ConnectionString' hides inherited member 'ADODB.Connection15.ConnectionString'
'ADODB.Recordset.BOF' hides inherited member 'ADODB.Recordset15.BOF'.

 

The problem has to be dealt with within the sqldmo.dll.xml file itself. To drastically change how we stub the commonly-used dlls is not feasible.

In order to correct the matter, you must manually remove references to ident2 coclasses from the idf and add the following TypeDef statements:

 

1
2
3
4
<typedef id="Database2" type="Database" />
<typedef id="Index2" type="Index" />
<typedef id="Table2" type="Table" />
<typedef id="SQLServer2" type="SqlServer" />

 

This problem also occurs with the web browser control (ieframe.dll).  for example, the following types of errors are reported:

ERRNUM: CS0234: The type or namespace name 'DWebBrowserEvents2_DocumentCompleteEvent' does not exist in the namespace 'SHDocVw'.
NETSRC: frmAppConsole.cs@1427
private void wbMain_DocumentComplete(object sender, SHDocVw.DWebBrowserEvents2_DocumentCompleteEvent e)

I corrected this by replacing the versioned coclasses with typedefs.