共用方式為


ReportAVOnComRelease 

The ReportAVOnComRelease managed debugging assistant (MDA) is activated when exceptions are thrown due to user reference counting errors while performing COM interop and using the Release or ReleaseComObject method combined with raw COM calls.

Symptoms

Access violations and memory corruption.

Cause

Occasionally, an exception is thrown due to user reference counting errors while performing COM interop and using the Release or ReleaseComObject method combined with raw COM calls. Normally, this exception is discarded because not doing so would cause an access violation in the CLR, bringing it down. When this assistant is enabled, such exceptions can be detected and reported instead of being simply discarded.

Resolution

Examine your reference counting code and search for errors as well as examining the native clients of your object for reference counting errors.

Effect on the Runtime

Two modes are available. If the allowAV attribute is true, then the assistant prevents the runtime from discarding the access violation. If allowAV is false, the default, then the runtime discards the access violation, but a warning message is reported to the user to indicate that an exception was thrown and discarded.

Output

If possible, the output contains the COM interface pointer's original vtable. Otherwise, an informational message is displayed.

Configuration

<mdaConfig>
  <assistants>
    <reportAvOnComRelease allowAv="false"/>
  </assistants>
</mdaConfig>

See Also

Reference

MarshalAsAttribute

Concepts

Diagnosing Errors with Managed Debugging Assistants
Interop Marshaling Overview

Other Resources

Interoperability