marshalCleanupError MDA
Note
This article is specific to .NET Framework. It doesn't apply to newer implementations of .NET, including .NET 6 and later versions.
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 marshalling data types between native and managed code boundaries.
Symptoms
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.
Cause
An unexpected error occurred while cleaning up temporary structures.
Resolution
Review all SafeHandle destructor, finalizer, and custom marshaller implementations for errors.
Effect on the Runtime
This MDA has no effect on the CLR.
Output
A message reporting the operation that failed during cleanup.
Configuration
<mdaConfig>
<assistants>
<marshalCleanupError />
</assistants>
</mdaConfig>