Another reason for using a custom marshaler may be to replace the behavior of the runtime’s generic marshaler. For example, the generic marshaler always converts COM HRESULTs to NGWS runtime exceptions and vice versa. You may, for one reason or another, not like that approach and would instead prefer to expose the HRESULTs directly to the managed applications. Because the custom marshaler completely replaces the runtime’s generic marshaler for a give parameter of field, any behavior of the generic can be replaced with a custom implementation.