The OverlappedFreeError managed debugging assistant (MDA) is activated when themethod is called before the overlapped operation has completed.
An overlapped structure was freed before the operation completed. The function that is using the overlapped pointer might write to the structure later, after it has been freed. That can cause heap corruption because another object might now occupy that region.
This MDA might not represent an error if the overlapped operation did not start successfully.
The following is sample output for this 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.