You create a serviced component named OrderProcessor. OrderProcessor implements the IOrderInit interface. The component and the interface contain the following code segments:
[Guid(“0B6ABB29-43D6-40a6-B5F2-83A457D062AC”)]
[InterfaceType(ComInterfaceType.InterfaceIsDual)]
public interface IOrderInit {
// IOrderInit methods go here.
}
public class OrderProcessor: ServicedComponent, IOrderInit { // OrderProcessor methods go here.
}
You discover that every time you rebuild OrderProcessor, existing unmanaged client code fails. The HRESULT for the exception is 0x80040154. The exception includes the following message: “Class not registered.” You need to resolve this problem.
What should you do?
A.
Add a Guid attribute to the OrderProcessor class.
B.
Add a ComImport attribute to the IOrderInit interface.
C.
To the OrderProcessor class, add the following attribute:
[ClassInterface(ClassInterfaceType.AutoDual)]
D.
To the end of every method, add the following line of code:
Marshal.ReleaseComObject(this);