|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.|
The DirtyCastAndCallOnInterface managed debugging assistant (MDA) is activated when an early-bound call through a vtable is attempted on a class interface that has been marked late-bound only.
Code is attempting an early-bound call through a vtable via a class interface that is late-bound only. Note that by default class interfaces are identified as being late-bound only. They can also be identified as late-bound with theattribute with an value ([ClassInterface(ClassInterfaceType.AutoDispatch)]).
The recommended resolution is to define an explicit interface for use by COM and have the COM clients call through this interface instead of through the automatically generated class interface. Alternatively, the call from COM can be transformed into a late-bound call via IDispatch.
Finally, it is possible to identify the class as([ClassInterface(ClassInterfaceType.AutoDual)]) to allow early bound calls to be placed from COM; however, using AutoDual is strongly discouraged because of the versioning limitations described in ClassInterfaceAttribute.