|Important||This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer|
Serviced Component Programming Guidelines
Although the .NET Framework extends many of the programming features introduced by COM, and although the common language runtime provides simplified access across the interoperation boundary, a COM client must adhere to the restrictions of its programming model. These restrictions can affect how and when you use the extensive features available to .NET Framework components. Therefore, you should consider who will use your .NET Framework component before you build it. Your early efforts to identify whether callers are COM-based can save you substantial time in the future.
In order for a COM client to use a .NET Framework component, it must adhere to the following limitations.
Do not use a parameterized constructor.
Avoid using static methods.
Define interfaces implemented by the component.
Include HRESULTs in user-defined exceptions.
Supply GUIDs for types that require them.