Assistant Débogage managé overlappedFreeError

L’Assistant Débogage managé overlappedFreeError est activé quand la méthode Overlapped.Free(NativeOverlapped*) est appelée avant la fin de l’opération avec chevauchement.

Symptômes

Violations d’accès ou altération du tas de la garbage collection.

Cause

Une structure avec chevauchement a été libérée avant la fin de l’opération. La fonction qui utilise le pointeur avec chevauchement peut écrire dans la structure ultérieurement, une fois qu’elle a été libérée. Ceci peut entraîner une altération du tas, car un autre objet devrait maintenant occuper cette région.

Cet Assistant Débogage managé peut ne pas représenter une erreur si l’opération avec chevauchement n’a pas démarré correctement.

Résolution

Vérifiez que l’opération d’E/S utilisant la structure avec chevauchement est terminée avant d’appeler la méthode Free(NativeOverlapped*).

Effet sur le runtime

Cet Assistant Débogage managé n'a aucun effet sur le CLR.

Sortie

Voici un exemple de sortie pour cet Assistant Débogage managé.

An overlapped pointer (0x00ea3430) that was not allocated on the GC heap was passed via Pinvoke to the win32 function 'WriteFile' in module 'KERNEL32.DLL'. If the AppDomain is shut down, this can cause heap corruption when the async I/O completes. The best solution is to pass a NativeOverlappedStructure retrieved from a call to System.Threading.Overlapped.Pack(). If the AppDomain exits, the CLR will keep this structure alive and pinned until the I/O completes.

Configuration

<mdaConfig>  
  <assistants>  
    <overlappedFreeError/>  
  </assistants>  
</mdaConfig>  

Voir aussi