Search code examples
vb.netvisual-studio-2015comclass-diagram

Show Base Class throws error if base class is generic and in a class library


Say I have a class library project (Library) which contains a class of:

Public Class SomeClass(Of TTypeA, TTypeB)

Then, in another project UIProject in a different solution, I define a class that is derived from (inherits) SomeClass:

Imports Library
Public Class SomeDerivedClass
Inherits SomeClass(Of String, Boolean)

I have included Library.pdb and Library.xml alongside Library.dll (in the same folder) when I added the class libary reference to the UIProject.

Now, In UIProject I create a ClassDiagram (ClassDiagram1.cd), and add in the SomeClass class. So far so good.

The next step is to right-click on SomeClass in the diagram, and select "Show Base Class" from the dropdown. At this point, I am given the error:

Error HRESULT E_FAIL has been returned from a call to a COM component.

If I do the same but for a non-generic version of SomeClass, then SomeClass is included in the class diagram, no problem.

No errors show up in ActivityLog.xml; nor in the Windows Event Viewer.

Is this a bug in Visual Studio (in which case I'll report it); or am I doing something wrong (and if so are there any other error logs or traces I can do to narrow down the issue further)?


Solution

  • The answer seems to be that COM does not work with generic types; and that it works in VS2017.