overlappedFreeError MDA

메모

이 문서는 .NET Framework와 관련이 있습니다. .NET 6 이상 버전을 포함하여 .NET의 최신 구현에는 적용되지 않습니다.

overlappedFreeError 겹치는 작업이 완료되기 전에 메서드가 Overlapped.Free(NativeOverlapped*) 호출될 때 MDA(관리 디버깅 도우미)가 활성화됩니다.

Symptoms

가비지 수집 힙의 액세스 위반 또는 손상

원인

작업이 완료되기 전에 겹치는 구조체가 해제되었습니다. 겹치는 포인터를 사용하는 함수는 해제된 후 나중에 구조체에 쓸 수 있습니다. 이제 다른 개체가 해당 지역을 차지할 수 있으므로 힙이 손상될 수 있습니다.

겹치는 작업이 성공적으로 시작되지 않은 경우 이 MDA는 오류를 나타내지 않을 수 있습니다.

해결 방법

메서드를 호출 Free(NativeOverlapped*) 하기 전에 겹치는 구조를 사용하는 I/O 작업이 완료되었는지 확인합니다.

런타임에 미치는 영향

이 MDA는 CLR에 영향을 주지 않습니다.

출력

다음은 이 MDA에 대한 샘플 출력입니다.

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.

구성 / 설정

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

참고하십시오