Condividi tramite


InvalidVariant 

The InvalidVariant managed debugging assistant (MDA) is activated when an invalid VARIANT structure is encountered during a call from native or unmanaged code to managed code.

Symptoms

Unexpected behavior during a transition between native and managed code involving the marshaling of a VARIANT to an object.

Cause

Native code is passing a malformed VARIANT structure to managed code. The runtime attempts to marshal this VARIANT to an object and activates the MDA if the VARIANT is not valid. Examples of invalid VARIANTS include a VARIANT with VARTYPE VT_EMPTY | VT_BYREF or a VARIANT with VARTYPE VT_VARIANT.

Resolution

The native or unmanaged code passing the VARIANT must ensure that the VARIANT is correctly formed and initialized.

Effect on the Runtime

The MDA has no effect on the runtime's behavior.

Output

An MDA message indicating that the runtime detected an invalid VARIANT passed to managed code by an unmanaged module.

Configuration

<mdaConfig>
  <assistants>
    <invalidVariant />
  </assistants>
</mdaConfig>

See Also

Reference

MarshalAsAttribute

Concepts

Diagnosing Errors with Managed Debugging Assistants
Interop Marshaling Overview

Other Resources

Interoperability