This documentation is archived and is not being maintained.


The MarshalCleanupError managed debugging assistant (MDA) is activated when the common language runtime (CLR) encounters an error while attempting to clean up temporary structures and memory used for marshaling data types between native and managed code boundaries.

A memory leak occurs when making native and managed code transitions, runtime state such as thread culture is not restored, or errors occur in SafeHandle cleanup.

An unexpected error occurred while cleaning up temporary structures.

Review all SafeHandle destructor, finalizer, and custom marshaler implementations for errors.

This MDA has no effect on the CLR.

A message reporting the operation that failed during cleanup.

    <marshalCleanupError enable="false" />