Compiler Error CS0424
TOC
Collapse the table of content
Expand the table of content
The document is archived and information here might be outdated

Compiler Error CS0424

'class': a class with the ComImport attribute cannot specify a base class

Specifying the ComImportAttribute attribute implies that the implementation for the class is to be imported from a COM module. Additional methods or fields inherited from the base class are not allowed to be added to the implementation defined in the COM module.

The following sample generates CS0424:

// CS0424.cs
// compile with: /target:library
using System.Runtime.InteropServices;
public class A {}

[ ComImport, Guid("7ab770c7-0e23-4d7a-8aa2-19bfad479829") ]
class B : A {}   // CS0424 error
Show:
© 2016 Microsoft