Share via


MarshalCleanupError 

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.

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 marshaler 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 enable="false" />
  </assistants>
</mdaConfig>

See Also

Reference

MarshalAsAttribute

Concepts

Diagnosing Errors with Managed Debugging Assistants
Interop Marshaling Overview

Other Resources

Interoperability