invalidOverlappedToPinvoke MDA

The invalidOverlappedToPinvoke مدارة تصحيح الأخطاء assistant (MDA) هو activated when an overlapped مؤشر that was not تاريخ الإنشاء تشغيل the garbage مجموعة كومة ذاكرة مؤقتة هو passed إلى specific Win32 دالات.

ملاحظةملاحظة

بشكل افتراضي، يتم تنشيط هذا MDA فقط إذا كان استدعاء النظام الأساسي يتم تعريف الاتصال في تعليمات برمجية وتقارير مصحح الأخطاء بحالة JustMyCode لكل أسلوب من الأساليب (انظر كيفية القيام بما يلي: انتقل إلى "التعليمات البرمجية الخاصة بي فقط").A debugger that does not understand JustMyCode (such كـ MDbg.exe مع لا ملحقات) will not تنشيط this MDA.This MDA can be ممكّن for those مصحح أخطاء البرنامج بواسطة using a ملف تكوين و بوضوح settting justMyCode="false" في the .mda.config file (<invalidOverlappedToPinvoke enable="true" justMyCode="false"/>).

الأعراض

Crashes أو unexplainable كومة ذاكرة مؤقتة corruptions.

السبب

An overlapped مؤشر that was not تاريخ الإنشاء تشغيل the garbage مجموعة كومة ذاكرة مؤقتة هو passed إلى specific operating النظام دالات.

The following جدول shows the دالات that this MDA tracks.

الوحدة النمطية

الوظيفة

HttpApi.dll

HttpReceiveHttpRequest

IpHlpApi.dll

NotifyAddrChange

kernel32.dll

ReadFile

kernel32.dll

ReadFileEx

kernel32.dll

WriteFile

kernel32.dll

WriteFileEx

kernel32.dll

ReadDirectoryChangesW

kernel32.dll

PostQueuedCompletionStatus

MSWSock.dll

ConnectEx

WS2_32.dll

WSASend

WS2_32.dll

WSASendTo

WS2_32.dll

WSARecv

WS2_32.dll

WSARecvFrom

MQRT.dll

MQReceiveMessage

The potential for كومة ذاكرة مؤقتة corruption هو عالي for this شرط because the AppDomain making the يتصل might unload. If the AppDomain unloads, the تطبيق تعليمات برمجية will either حر the ذاكرة for the overlapped مؤشر, causing corruption when the تشغيل finishes, أو the تعليمات برمجية will leak the ذاكرة, causing difficulties later.

الدقة

استخدم an Overlapped كائن, calling the Pack أسلوب إلى يحصل a NativeOverlapped بنية that can be passed إلى the دالة. If the AppDomain unloads, the CLR waits until the غير متزامن تشغيل completes قبل freeing the مؤشر.

التأثير تشغيل وقت التشغيل

This MDA had بلا تأثير تشغيل the CLR.

الإخراج

The following هو an مثال of إخراج من 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 NativeOverlapped structure 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>
    <invalidOverlappedToPinvoke/>
  </assistants>
</mdaConfig>

راجع أيضًا:

المرجع

MarshalAsAttribute

المبادئ

تشخيص الأخطاء مع المساعدين التصحيح مدارة

تنظيم إمكانية التشغيل المتداخل