Remove more MDA support code (#24457)
authorSteve MacLean <stmaclea@microsoft.com>
Wed, 8 May 2019 20:08:29 +0000 (16:08 -0400)
committerGitHub <noreply@github.com>
Wed, 8 May 2019 20:08:29 +0000 (16:08 -0400)
* Remove more MDA support code

* PR Feedback

62 files changed:
src/System.Private.CoreLib/src/System/StubHelpers.cs
src/classlibnative/bcltype/objectnative.cpp
src/utilcode/debug.cpp
src/vm/CMakeLists.txt
src/vm/appdomain.cpp
src/vm/assembly.cpp
src/vm/assemblyspec.cpp
src/vm/ceemain.cpp
src/vm/class.cpp
src/vm/clrex.h
src/vm/clrtocomcall.cpp
src/vm/clsload.cpp
src/vm/comcache.cpp
src/vm/comcallablewrapper.cpp
src/vm/comdelegate.cpp
src/vm/comdelegate.h
src/vm/comtoclrcall.cpp
src/vm/custommarshalerinfo.cpp
src/vm/dllimport.cpp
src/vm/dllimport.h
src/vm/dllimportcallback.cpp
src/vm/dllimportcallback.h
src/vm/ecalllist.h
src/vm/excep.cpp
src/vm/frames.cpp
src/vm/i386/asmconstants.h
src/vm/i386/asmhelpers.asm
src/vm/i386/cgencpu.h
src/vm/i386/cgenx86.cpp
src/vm/i386/stublinkerx86.cpp
src/vm/interopconverter.cpp
src/vm/interoputil.cpp
src/vm/jitinterface.cpp
src/vm/loaderallocator.cpp
src/vm/mda.h [deleted file]
src/vm/mda.inl [deleted file]
src/vm/mdaBoilerplate.exe.mda.config [deleted file]
src/vm/mdaassistants.cpp [deleted file]
src/vm/mdaassistants.h [deleted file]
src/vm/mdaassistantschemas.inl [deleted file]
src/vm/mdagroups.inl [deleted file]
src/vm/mdamacroscrubber.inl [deleted file]
src/vm/mdaschema.inl [deleted file]
src/vm/method.hpp
src/vm/methodtablebuilder.cpp
src/vm/mlinfo.cpp
src/vm/mscorlib.cpp
src/vm/mscorlib.h
src/vm/nativeoverlapped.cpp
src/vm/notifyexternals.cpp
src/vm/olevariant.cpp
src/vm/prestub.cpp
src/vm/runtimecallablewrapper.cpp
src/vm/runtimecallablewrapper.h
src/vm/safehandle.cpp
src/vm/stdinterfaces.h
src/vm/stdinterfaces_wrapper.cpp
src/vm/stubhelpers.cpp
src/vm/stubhelpers.h
src/vm/threads.cpp
src/vm/threads.h
src/vm/threadsuspend.cpp

index 763efbb..152d9a7 100644 (file)
@@ -1663,16 +1663,6 @@ namespace System.StubHelpers
         [MethodImplAttribute(MethodImplOptions.InternalCall)]
         internal static extern Delegate GetTargetForAmbiguousVariantCall(object objSrc, IntPtr pMT, out bool fUseString);
 
-        //-------------------------------------------------------
-        // Helper for the MDA RaceOnRCWCleanup
-        //-------------------------------------------------------
-
-        [MethodImplAttribute(MethodImplOptions.InternalCall)]
-        internal static extern void StubRegisterRCW(object pThis);
-
-        [MethodImplAttribute(MethodImplOptions.InternalCall)]
-        internal static extern void StubUnregisterRCW(object pThis);
-
         [MethodImplAttribute(MethodImplOptions.InternalCall)]
         internal static extern IntPtr GetDelegateInvokeMethod(Delegate pThis);
 
@@ -1685,18 +1675,8 @@ namespace System.StubHelpers
         [MethodImplAttribute(MethodImplOptions.InternalCall)]
         internal static extern IntPtr GetOuterInspectable(object pThis, IntPtr pCtorMD);
 
-#if MDA_SUPPORTED
-        [MethodImplAttribute(MethodImplOptions.InternalCall)]
-        internal static extern Exception TriggerExceptionSwallowedMDA(Exception ex, IntPtr pManagedTarget);
-#endif // MDA_SUPPORTED
-
 #endif // FEATURE_COMINTEROP
 
-#if MDA_SUPPORTED
-        [MethodImplAttribute(MethodImplOptions.InternalCall)]
-        internal static extern void CheckCollectedDelegateMDA(IntPtr pEntryThunk);
-#endif // MDA_SUPPORTED
-
         //-------------------------------------------------------
         // Profiler helpers
         //-------------------------------------------------------
@@ -1759,11 +1739,6 @@ namespace System.StubHelpers
         internal static extern IntPtr GetStubContextAddr();
 #endif // BIT64
 
-#if MDA_SUPPORTED
-        [MethodImplAttribute(MethodImplOptions.InternalCall)]
-        internal static extern void TriggerGCForMDA();        
-#endif // MDA_SUPPORTED
-
 #if FEATURE_ARRAYSTUB_AS_IL
         [MethodImplAttribute(MethodImplOptions.InternalCall)]
         internal static extern void ArrayTypeCheck(object o, Object[] arr);
index a5619e1..14e4cee 100644 (file)
@@ -19,7 +19,6 @@
 #include "object.h"
 #include "comsynchronizable.h"
 #include "eeconfig.h"
-#include "mdaassistants.h"
 
 
 /********************************************************************/
@@ -76,17 +75,8 @@ NOINLINE static INT32 GetHashCodeHelper(OBJECTREF objRef)
 
     HELPER_METHOD_FRAME_BEGIN_RET_ATTRIB_1(Frame::FRAME_ATTR_EXACT_DEPTH|Frame::FRAME_ATTR_CAPTURE_DEPTH_2, objRef);   
 
-#ifdef MDA_SUPPORTED
-    MdaModuloObjectHashcode* pProbe = MDA_GET_ASSISTANT(ModuloObjectHashcode);
-#endif
-        
     idx = objRef->GetHashCodeEx();
 
-#ifdef MDA_SUPPORTED
-    if (pProbe)
-        idx = idx % pProbe->GetModulo();
-#endif
-
     HELPER_METHOD_FRAME_END();
     FC_INNER_EPILOG();
     return idx;
@@ -110,9 +100,6 @@ FCIMPL1(INT32, ObjectNative::GetHashCode, Object* obj) {
 
     OBJECTREF objRef(obj);
 
-#ifdef MDA_SUPPORTED
-    if (!MDA_GET_ASSISTANT(ModuloObjectHashcode))
-#endif
     {
         DWORD bits = objRef->GetHeader()->GetBits();
 
index 40c5c0e..145d495 100644 (file)
@@ -620,12 +620,6 @@ CHAR g_szExprWithStack2[10480];
 #endif
 void *dbgForceToMemory;     // dummy pointer that pessimises enregistration
 
-#ifdef MDA_SUPPORTED
-#ifdef _DEBUG
-BOOL g_bMdaDisableAsserts = FALSE;
-#endif
-#endif
-
 int g_BufferLock = -1;
 
 VOID DbgAssertDialog(const char *szFile, int iLine, const char *szExpr)
@@ -637,13 +631,6 @@ VOID DbgAssertDialog(const char *szFile, int iLine, const char *szExpr)
     
     DEBUG_ONLY_FUNCTION;
 
-#ifdef MDA_SUPPORTED
-#ifdef _DEBUG
-    if (g_bMdaDisableAsserts)
-        return;
-#endif
-#endif
-
 #ifdef DACCESS_COMPILE
     // In the DAC case, asserts can mean one of two things.
     // Either there is a bug in the DAC infrastructure itself (a real assert), or just
index 76adac0..df83214 100644 (file)
@@ -352,7 +352,6 @@ set(VM_SOURCES_WKS
     jithelpers.cpp
     managedmdimport.cpp
     marshalnative.cpp
-    mdaassistants.cpp
     methodtablebuilder.cpp
     mlinfo.cpp
     mscorlib.cpp # <DisablePrecompiledHeaders>true</DisablePrecompiledHeaders>
@@ -475,7 +474,6 @@ set(VM_HEADERS_WKS
     invokeutil.h
     managedmdimport.hpp
     marshalnative.h
-    mdaassistants.h
     methodtablebuilder.h
     mlinfo.h
     mscorlib.h
index 480a260..9f5749a 100644 (file)
@@ -56,7 +56,6 @@
 
 #include "appdomain.inl"
 #include "typeparse.h"
-#include "mdaassistants.h"
 #include "threadpoolrequest.h"
 
 #include "nativeoverlapped.h"
@@ -5378,9 +5377,6 @@ EndTry2:;
                         if (!pSpec->IsMscorlibSatellite())
                         {
                             // Trigger the resolve event also for non-throw situation.
-                            // However, this code path will behave as if the resolve handler has thrown,
-                            // that is, not trigger an MDA.
-
                             AssemblySpec NewSpec(this);
                             AssemblySpec *pFailedSpec = NULL;
 
@@ -5422,28 +5418,7 @@ EndTry2:;
                     // Only throw this exception if we are the first in the cache
                     if (fFailure)
                     {
-                        //
-                        // If the BindingFailure MDA is enabled, trigger one for this failure
-                        // Note: TryResolveAssembly() can also throw if an AssemblyResolve event subscriber throws
-                        //       and the MDA isn't sent in this case (or for transient failure cases)
-                        //
-#ifdef MDA_SUPPORTED
-                        MdaBindingFailure* pProbe = MDA_GET_ASSISTANT(BindingFailure);
-                        if (pProbe)
-                        {
-                            // Transition to cooperative GC mode before using any OBJECTREFs.
-                            GCX_COOP();
-
-                            OBJECTREF exceptionObj = GET_THROWABLE();
-                            GCPROTECT_BEGIN(exceptionObj)
-                            {
-                                pProbe->BindFailed(pFailedSpec, &exceptionObj);
-                            }
-                            GCPROTECT_END();
-                        }
-#endif
-
-                        // In the same cases as for the MDA, store the failure information for DAC to read
+                        // Store the failure information for DAC to read
                         if (IsDebuggerAttached()) {
                             FailedAssembly *pFailed = new FailedAssembly();
                             pFailed->Initialize(pFailedSpec, ex);
@@ -5452,7 +5427,6 @@ EndTry2:;
 
                         if (!bFileNotFoundException || fThrowOnFileNotFound)
                         {
-
                             // V1.1 App-compatibility workaround. See VSW530166 if you want to whine about it.
                             //
                             // In Everett, if we failed to download an assembly because of a broken network cable,
index 80e7f9c..ddb5417 100644 (file)
@@ -47,7 +47,6 @@
 
 #include "caparser.h"
 #include "../md/compiler/custattr.h"
-#include "mdaassistants.h"
 
 #include "peimagelayout.inl"
 
index ad2ebfd..4057b00 100644 (file)
@@ -22,7 +22,6 @@
 #include "eeconfig.h"
 #include "strongname.h"
 #include "strongnameholders.h"
-#include "mdaassistants.h"
 #include "eventtrace.h"
 
 #ifdef FEATURE_COMINTEROP
index 1420b59..05bb36b 100644 (file)
 #include "syncclean.hpp"
 #include "typeparse.h"
 #include "debuginfostore.h"
-#include "mdaassistants.h"
 #include "eemessagebox.h"
 #include "finalizerthread.h"
 #include "threadsuspend.h"
@@ -872,10 +871,6 @@ void EEStartupHelper(COINITIEE fFlags)
         }
 #endif // DEBUGGING_SUPPORTED
 
-#ifdef MDA_SUPPORTED
-        ManagedDebuggingAssistants::EEStartupActivation();
-#endif
-
 #ifdef PROFILING_SUPPORTED
         // Initialize the profiling services.
         hr = ProfilingAPIUtility::InitializeProfiling();
@@ -1261,11 +1256,6 @@ static void ExternalShutdownHelper(int exitCode, ShutdownCompleteAction sca)
     if (g_fEEShutDown || !g_fEEStarted)
         return;
 
-    if (HasIllegalReentrancy())
-    {
-        return;
-    }
-    else
     if (!CanRunManagedCode())
     {
         return;
@@ -1994,7 +1984,7 @@ NOINLINE BOOL CanRunManagedCodeRare(LoaderLockCheck::kind checkKind, HINSTANCE h
 {
     CONTRACTL {
         NOTHROW;
-        if (checkKind == LoaderLockCheck::ForMDA) { GC_TRIGGERS; } else { GC_NOTRIGGER; }; // because of the CustomerDebugProbe
+        GC_NOTRIGGER;
         MODE_ANY;
     } CONTRACTL_END;
 
@@ -2012,39 +2002,6 @@ NOINLINE BOOL CanRunManagedCodeRare(LoaderLockCheck::kind checkKind, HINSTANCE h
     if ((g_fEEShutDown & ShutDown_Finalize2) && !FinalizerThread::IsCurrentThreadFinalizer())
         return FALSE;
 
-#if defined(FEATURE_COMINTEROP) && defined(MDA_SUPPORTED)
-    if ((checkKind == LoaderLockCheck::ForMDA) && (NULL == MDA_GET_ASSISTANT(LoaderLock))) 
-        return TRUE;
-
-    if (checkKind == LoaderLockCheck::None)
-        return TRUE;
-
-    // If we are checking whether the OS loader lock is held by the current thread, then
-    // it better not be.  Note that ShouldCheckLoaderLock is a cached test for whether
-    // we are checking this probe.  So we can call AuxUlibIsDLLSynchronizationHeld before
-    // verifying that the probe is still enabled.
-    //
-    // What's the difference between ignoreLoaderLock & ShouldCheckLoaderLock?
-    // ShouldCheckLoaderLock is a process-wide flag.  In a few places where we
-    // *know* we are in the loader lock but haven't quite reached the dangerous
-    // point, we call CanRunManagedCode suppressing/deferring this check.
-    BOOL IsHeld;
-
-    if (ShouldCheckLoaderLock(FALSE) &&
-        AuxUlibIsDLLSynchronizationHeld(&IsHeld) &&
-        IsHeld)
-    {
-        if (checkKind == LoaderLockCheck::ForMDA)
-        {
-            MDA_TRIGGER_ASSISTANT(LoaderLock, ReportViolation(hInst));
-        }
-        else
-        {
-            return FALSE;
-        }
-    }
-#endif // defined(FEATURE_COMINTEROP) && defined(MDA_SUPPORTED)
-
     return TRUE;
 }
 
@@ -2053,7 +2010,7 @@ BOOL CanRunManagedCode(LoaderLockCheck::kind checkKind, HINSTANCE hInst /*= 0*/)
 {
     CONTRACTL {
         NOTHROW;
-        if (checkKind == LoaderLockCheck::ForMDA) { GC_TRIGGERS; } else { GC_NOTRIGGER; }; // because of the CustomerDebugProbe
+        GC_NOTRIGGER;
         MODE_ANY;
     } CONTRACTL_END;
 
@@ -2062,11 +2019,7 @@ BOOL CanRunManagedCode(LoaderLockCheck::kind checkKind, HINSTANCE hInst /*= 0*/)
     if (!g_fForbidEnterEE 
         && (g_pPreallocatedOutOfMemoryException != NULL)
         && !(g_fEEShutDown & ShutDown_Finalize2)
-        && (((checkKind == LoaderLockCheck::ForMDA) 
-#ifdef MDA_SUPPORTED
-             && (NULL == MDA_GET_ASSISTANT(LoaderLock))
-#endif // MDA_SUPPORTED
-            ) || (checkKind == LoaderLockCheck::None)))
+        && ((checkKind == LoaderLockCheck::None)))
     {
         return TRUE;
     }
index 4d03db7..fe765b0 100644 (file)
@@ -13,6 +13,7 @@
 #include "customattribute.h"
 #include "encee.h"
 #include "typestring.h"
+#include "dbginterface.h"
 
 #ifdef FEATURE_COMINTEROP 
 #include "comcallablewrapper.h"
index c1cd80d..040ad2c 100644 (file)
@@ -965,31 +965,18 @@ LONG CLRNoCatchHandler(EXCEPTION_POINTERS* pExceptionInfo, PVOID pv);
 // Comments:
 //   The BEGIN macro will setup a Thread if necessary. It should only be called
 //   in preemptive mode.  If you are calling it from cooperative mode, this implies
-//   we are executing "external" code in cooperative mode.  The Reentrancy MDA
-//   complains about this.
+//   we are executing "external" code in cooperative mode.
 //
 //   Only use this macro for actual boundaries between CLR and
 //   outside unmanaged code. If you want to connect internal pieces
 //   of CLR code, use EX_TRY instead.
 //===================================================================================
-#ifdef MDA_SUPPORTED
-NOINLINE BOOL HasIllegalReentrancyRare();
-#define HAS_ILLEGAL_REENTRANCY()  (NULL != MDA_GET_ASSISTANT(Reentrancy) && HasIllegalReentrancyRare())
-#else
-#define HAS_ILLEGAL_REENTRANCY() false
-#endif
-
 #define BEGIN_EXTERNAL_ENTRYPOINT(phresult)                             \
     {                                                                   \
         HRESULT *__phr = (phresult);                                    \
         *__phr = S_OK;                                                  \
         _ASSERTE(GetThread() == NULL ||                                 \
                     !GetThread()->PreemptiveGCDisabled());              \
-        if (HAS_ILLEGAL_REENTRANCY())                                   \
-        {                                                               \
-            *__phr = COR_E_ILLEGAL_REENTRANCY;                          \
-        }                                                               \
-        else                                                            \
         if (!CanRunManagedCode())                                       \
         {                                                               \
             *__phr = E_PROCESS_SHUTDOWN_REENTRY;                        \
index 4aba529..2d7d7ba 100644 (file)
@@ -24,7 +24,6 @@
 #include "eeconfig.h"
 #include "corhost.h"
 #include "reflectioninvocation.h"
-#include "mdaassistants.h"
 #include "sigbuilder.h"
 #include "callsiteinspect.h"
 
index 67b4dee..2909c64 100644 (file)
@@ -45,7 +45,6 @@
 #include "typekey.h"
 #include "pendingload.h"
 #include "proftoeeinterfaceimpl.h"
-#include "mdaassistants.h"
 #include "virtualcallstub.h"
 #include "stringarraylist.h"
 
index c63ec56..b5efbb7 100644 (file)
@@ -13,7 +13,6 @@
 #include "contxt.h"
 #include "ctxtcall.h"
 #include "win32threadpool.h"
-#include "mdaassistants.h"
 
 #ifdef FEATURE_COMINTEROP_APARTMENT_SUPPORT
 #include "olecontexthelpers.h"
@@ -226,9 +225,6 @@ struct CtxEntryEnterContextCallbackData
     LPVOID         m_pUserData;
     LPVOID         m_pCtxCookie;
     HRESULT        m_UserCallbackHR;
-#ifdef MDA_SUPPORTED
-    CLREvent*      m_hTimeoutEvent;
-#endif
 };
 
 //================================================================
@@ -657,17 +653,6 @@ IUnknown* IUnkEntry::UnmarshalIUnknownForCurrContext()
             // Otherwise, we return S_OK but m_pStream will stay being NULL
             hrCDH = MarshalIUnknownToStreamCallback(this);
             CheckForFuncEvalAbort(hrCDH);
-
-#ifdef MDA_SUPPORTED
-            if (FAILED(hrCDH))
-            {
-                MDA_TRIGGER_ASSISTANT(DisconnectedContext, ReportViolationDisconnected(m_pCtxCookie, hrCDH));
-            }
-            else if (m_pStream == NULL)
-            {
-                MDA_TRIGGER_ASSISTANT(NotMarshalable, ReportViolation());
-            }
-#endif
         }
 
         if (TryUpdateEntry())                
@@ -939,17 +924,6 @@ IUnknown* IUnkEntry::UnmarshalIUnknownForCurrContextHelper()
 
     CheckForFuncEvalAbort(hrCDH);
 
-#ifdef MDA_SUPPORTED
-    if (FAILED(hrCDH))
-    {
-        MDA_TRIGGER_ASSISTANT(DisconnectedContext, ReportViolationDisconnected(m_pCtxCookie, hrCDH));
-    }
-    else if(spStream == NULL)
-    {
-        MDA_TRIGGER_ASSISTANT(NotMarshalable, ReportViolation());
-    }
-#endif
-
     // If the interface is not marshalable or if we failed to 
     // enter the context, then we don't have any choice but to 
     // use the raw IP.
@@ -1168,119 +1142,6 @@ VOID IUnkEntry::EndUpdateEntry()
 }
 
 
-#ifdef MDA_SUPPORTED
-
-// Default to a 60 second timeout
-#define MDA_CONTEXT_SWITCH_DEADLOCK_TIMEOUT 60000
-#define MDA_CONTEXT_SWITCH_DEADLOCK_ITERATION_COUNT 1000
-
-struct MDAContextSwitchDeadlockArgs
-{
-    CLREvent* hEvent;
-    LPVOID  OriginContext;
-    LPVOID  DestinationContext;
-};
-
-DWORD WINAPI MDAContextSwitchDeadlockThreadProc(LPVOID lpParameter)
-{
-    CONTRACTL
-    {
-        NOTHROW;
-        GC_TRIGGERS;
-        MODE_PREEMPTIVE;
-        PRECONDITION(CheckPointer(MDA_GET_ASSISTANT(ContextSwitchDeadlock)));
-    }
-    CONTRACTL_END;
-
-    // We need to ensure a thread object has been set up since we will toggle to cooperative GC mode
-    // inside the wait loop.
-    Thread *pThread = SetupThreadNoThrow();
-    if (pThread == NULL)
-    {
-        // If we failed to allocate the thread object, we will skip running the watchdog thread
-        // and simply return.
-        return 0;
-    }
-
-    DWORD retval = 0;
-    NewHolder<MDAContextSwitchDeadlockArgs> args = (MDAContextSwitchDeadlockArgs*)lpParameter;
-
-    // This interesting piece of code allows us to avoid firing the MDA when a process is
-    // being debugged while the context transition is in progress. It is needed because
-    // CLREvent::Wait will timeout after the specified amount of wall time, even if the
-    // process is broken into the debugger for a portion of the time. By splitting the 
-    // wait into a bunch of smaller waits, we allow many more step/continue operations to
-    // occur before we signal the timeout.
-    for (int i = 0; i < MDA_CONTEXT_SWITCH_DEADLOCK_ITERATION_COUNT; i++)
-    {
-        retval = args->hEvent->Wait(MDA_CONTEXT_SWITCH_DEADLOCK_TIMEOUT / MDA_CONTEXT_SWITCH_DEADLOCK_ITERATION_COUNT, FALSE);
-        if (retval != WAIT_TIMEOUT)
-            break;
-
-        // Transition to cooperative GC mode and back. This will allow us to stop the timeout
-        // if we are broken in while managed only debugging.
-        {
-            GCX_COOP();
-        }
-    }
-
-    if (retval == WAIT_TIMEOUT)
-    {
-        // We didn't transition into the context within the allotted timeout period.
-        // We'll fire the mda and close the event, but we can't delete is as the
-        //  thread may still complete the transition and attempt to signal the event.
-        //  So we'll just leak it and let the transition thread recognize that the
-        //  event is no longer valid so it can simply delete it.
-        MDA_TRIGGER_ASSISTANT(ContextSwitchDeadlock, ReportDeadlock(args->OriginContext, args->DestinationContext));
-        
-        args->hEvent->CloseEvent();       
-        return 1;
-    }
-
-    delete args->hEvent;
-    
-    return 0;
-}
-
-
-void QueueMDAThread(CtxEntryEnterContextCallbackData* data)
-{
-    CONTRACTL
-    {
-        NOTHROW;
-        GC_TRIGGERS;
-        MODE_ANY;
-        PRECONDITION(CheckPointer(data->m_hTimeoutEvent));
-    }
-    CONTRACTL_END;
-
-    MDAContextSwitchDeadlockArgs* args = NULL;
-    
-    EX_TRY
-    {
-        args = new MDAContextSwitchDeadlockArgs;
-        
-        args->OriginContext = GetCurrentCtxCookie();
-        args->DestinationContext = data->m_pCtxCookie;
-        args->hEvent = data->m_hTimeoutEvent;
-
-        // Will execute in the Default AppDomain
-        ThreadpoolMgr::QueueUserWorkItem(MDAContextSwitchDeadlockThreadProc, (LPVOID)args, WT_EXECUTELONGFUNCTION);
-    }
-    EX_CATCH
-    {
-        delete data->m_hTimeoutEvent;
-        data->m_hTimeoutEvent = NULL;
-
-        if (args)
-            delete args;
-    }
-    EX_END_CATCH(SwallowAllExceptions);
-}
-
-#endif // MDA_SUPPORTED
-
-
 // Initialize the entry, returns true on success (i.e. the entry was free).
 bool InterfaceEntry::Init(MethodTable* pMT, IUnknown* pUnk)
 {
@@ -1463,28 +1324,6 @@ HRESULT CtxEntry::EnterContext(PFNCTXCALLBACK pCallbackFunc, LPVOID pData)
     CallbackInfo.m_pUserData = pData;
     CallbackInfo.m_pCtxCookie = m_pCtxCookie;
     CallbackInfo.m_UserCallbackHR = E_FAIL;
-#ifdef MDA_SUPPORTED
-    CallbackInfo.m_hTimeoutEvent = NULL;
-
-    MdaContextSwitchDeadlock* mda = MDA_GET_ASSISTANT(ContextSwitchDeadlock);
-    if (mda)
-    {
-        EX_TRY
-        {          
-            CallbackInfo.m_hTimeoutEvent = new CLREvent();
-            CallbackInfo.m_hTimeoutEvent->CreateAutoEvent(FALSE);
-        }
-        EX_CATCH
-        {
-            if (CallbackInfo.m_hTimeoutEvent)
-            {
-                delete CallbackInfo.m_hTimeoutEvent;
-                CallbackInfo.m_hTimeoutEvent = NULL;
-            }
-        }
-        EX_END_CATCH(SwallowAllExceptions);
-    }
-#endif // MDA_SUPPORTED
 
     // Retrieve the IContextCallback interface from the IObjectContext.
     SafeComHolderPreemp<IContextCallback> pCallback;
@@ -1498,14 +1337,6 @@ HRESULT CtxEntry::EnterContext(PFNCTXCALLBACK pCallbackFunc, LPVOID pData)
     callBackData.dwReserved = 0;
     callBackData.pUserDefined = &CallbackInfo;
 
-#ifdef MDA_SUPPORTED
-    // Make sure we don't deadlock when trying to enter the context.
-    if (mda && CallbackInfo.m_hTimeoutEvent)
-    {
-        QueueMDAThread(&CallbackInfo);
-    }
-#endif
-
     EX_TRY
     {
         hr = ((IContextCallback*)pCallback)->ContextCallback(EnterContextCallback, &callBackData, IID_IEnterActivityWithNoLock, 2, NULL);
@@ -1556,24 +1387,6 @@ HRESULT __stdcall CtxEntry::EnterContextCallback(ComCallData* pComCallData)
     CtxEntryEnterContextCallbackData *pData = (CtxEntryEnterContextCallbackData*)pComCallData->pUserDefined;
 
 
-#ifdef MDA_SUPPORTED
-    // If active, signal the MDA watcher so we don't accidentally trigger a timeout.
-    MdaContextSwitchDeadlock* mda = MDA_GET_ASSISTANT(ContextSwitchDeadlock);
-    if (mda)
-    {
-        // If our watchdog worker is still waiting on us, the event will be valid.
-        if (pData->m_hTimeoutEvent->IsValid())
-        {
-            pData->m_hTimeoutEvent->Set();
-        }
-        else
-        {
-            // If we did timeout, we will have already cleaned up the event...just delete it now.
-            delete pData->m_hTimeoutEvent;
-        }
-    }
-#endif // MDA_SUPPORTED
-    
     Thread *pThread = GetThread();
     
     // Make sure the thread has been set before we call the user callback function.
index 39cd0a1..f38f180 100644 (file)
 #include "winrttypenameconverter.h"
 #include "typestring.h"
 
-#ifdef MDA_SUPPORTED
-const int DEBUG_AssertSlots = 50;
-#endif
-
 // The enum that describes the value of the IDispatchImplAttribute custom attribute.
 enum IDispatchImplType
 {
@@ -556,13 +552,6 @@ extern "C" PCODE ComPreStubWorker(ComPrestubMethodFrame *pPFrame, UINT64 *pError
 
                                 if (pADThrowable != NULL)
                                 {
-#ifdef MDA_SUPPORTED
-                                    if (fNonTransientExceptionThrown)
-                                    {
-                                        MDA_TRIGGER_ASSISTANT(InvalidMemberDeclaration, ReportViolation(pCMD, &pADThrowable));
-                                    }                    
-#endif
-                                    
                                     // Transform the exception into an HRESULT. This also sets up
                                     // an IErrorInfo on the current thread for the exception.
                                     hr = SetupErrorInfo(pADThrowable, pCMD);
@@ -4648,22 +4637,6 @@ void ComMethodTable::LayOutBasicMethodTable()
         pDispVtable->m_Invoke = (SLOT)Dispatch_Invoke_Wrapper;
     }
 
-#ifdef MDA_SUPPORTED
-#ifndef _DEBUG
-    // Only lay these out if the MDA is active when in retail.
-    if (NULL != MDA_GET_ASSISTANT(DirtyCastAndCallOnInterface))
-#endif
-        // Layout the assert stub slots so that people doing dirty casts get an assert telling
-        //  them what's wrong.
-    {
-        SLOT* assertSlot = ((SLOT*)(pDispVtable + 1));
-        for (int i = 0; i < DEBUG_AssertSlots; i++)
-        {
-            assertSlot[i] = (SLOT)DirtyCast_Assert;
-        }
-    }
-#endif
-    
     //
     // Set the layout complete flag.
     //
@@ -5390,12 +5363,6 @@ BOOL ComCallWrapperTemplate::CheckParentComVisibilityNoThrow(BOOL fForIDispatch)
     if (!HasInvisibleParent())
         return TRUE;
 
-#ifdef MDA_SUPPORTED
-    // Fire an MDA to help people diagnose the fact they are attempting to
-    // expose a class with a non COM visible base class to COM.
-    MDA_TRIGGER_ASSISTANT(NonComVisibleBaseClass, ReportViolation(m_thClass.GetMethodTable(), fForIDispatch));
-#endif
-
     return FALSE;    
 }
 
@@ -5751,17 +5718,6 @@ ComMethodTable* ComCallWrapperTemplate::CreateComMethodTableForBasic(MethodTable
     unsigned cbVtable    = cbExtraSlots * sizeof(SLOT);
     unsigned cbToAlloc   = sizeof(ComMethodTable) + cbVtable;
 
-#ifdef MDA_SUPPORTED
-#ifndef _DEBUG
-    // Only add these if the MDA is active while in retail.
-    if (NULL != MDA_GET_ASSISTANT(DirtyCastAndCallOnInterface))
-#endif
-    {
-        // Add some extra slots that will assert to catch dirty casts.
-        cbToAlloc += sizeof(SLOT) * DEBUG_AssertSlots;
-    }
-#endif
-
     NewExecutableHolder<ComMethodTable> pComMT = (ComMethodTable*) new (executable) BYTE[cbToAlloc]; 
 
     // set up the header
@@ -5789,8 +5745,7 @@ ComMethodTable* ComCallWrapperTemplate::CreateComMethodTableForBasic(MethodTable
     if (pMT->GetClass()->IsComClassInterface())
         pComMT->m_Flags |= enum_ComClassItf;
 
-#ifdef MDA_SUPPORTED
-#ifdef _DEBUG
+#ifdef _DEBUG_0xDEADCA11
     {
         // In debug set all the vtable slots to 0xDEADCA11.
         SLOT *pComVTable = (SLOT*)(pComMT + 1);
@@ -5798,8 +5753,6 @@ ComMethodTable* ComCallWrapperTemplate::CreateComMethodTableForBasic(MethodTable
             *(pComVTable + iComSlots) = (SLOT)(size_t)0xDEADCA11;
     }
 #endif
-#endif
-
 
     LOG((LF_INTEROP, LL_INFO1000, "---------- end of CreateComMethodTableForBasic %s -----------\n", pMT->GetDebugClassName()));
 
index 8d08541..b702940 100644 (file)
@@ -19,7 +19,6 @@
 #include "dllimportcallback.h"
 #include "dllimport.h"
 #include "eeconfig.h"
-#include "mdaassistants.h"
 #include "cgensys.h"
 #include "asmconstants.h"
 #include "virtualcallstub.h"
@@ -1254,27 +1253,7 @@ OBJECTREF COMDelegate::ConvertToDelegate(LPVOID pCallback, MethodTable* pMT)
     // Check if this callback was originally a managed method passed out to unmanaged code.
     //
 
-    UMEntryThunk* pUMEntryThunk = NULL;
-
-#ifdef MDA_SUPPORTED    
-    if (MDA_GET_ASSISTANT(InvalidFunctionPointerInDelegate))
-    {
-        EX_TRY
-        {
-            AVInRuntimeImplOkayHolder AVOkay;
-            pUMEntryThunk = UMEntryThunk::Decode(pCallback);
-        }
-        EX_CATCH
-        {
-            MDA_TRIGGER_ASSISTANT(InvalidFunctionPointerInDelegate, ReportViolation(pCallback));
-        }
-        EX_END_CATCH(SwallowAllExceptions)
-    }
-    else
-#endif // MDA_SUPPORTED
-    {
-        pUMEntryThunk = UMEntryThunk::Decode(pCallback);
-    }
+    UMEntryThunk* pUMEntryThunk = UMEntryThunk::Decode(pCallback);
 
     // Lookup the callsite in the hash, if found, we can map this call back to its managed function.
     // Otherwise, we'll treat this as an unmanaged callsite.
@@ -1377,12 +1356,6 @@ OBJECTREF COMDelegate::ConvertToDelegate(LPVOID pCallback, MethodTable* pMT)
         MethodDesc *pStubMD = pClass->m_pForwardStubMD;
         _ASSERTE(pStubMD != NULL && pStubMD->IsILStub());
 
-#if defined(MDA_SUPPORTED)
-        if (MDA_GET_ASSISTANT(PInvokeStackImbalance))
-        {
-            pInterceptStub = GenerateStubForMDA(pMD, pStubMD, pCallback, pInterceptStub);
-        }
-#endif // MDA_SUPPORTED
     }
 
     if (pInterceptStub != NULL)
@@ -3502,8 +3475,7 @@ static void TryConstructUnhandledExceptionArgs(OBJECTREF *pThrowable,
     {
         *pOutEventArgs = NULL;      // arguably better than half-constructed object
 
-        // It's not even worth asserting, because these aren't our bugs.  At
-        // some point, a MDA may be warranted.
+        // It's not even worth asserting, because these aren't our bugs.
     }
     EX_END_CATCH(SwallowAllExceptions)
 }
@@ -3570,8 +3542,7 @@ static void InvokeUnhandledSwallowing(OBJECTREF *pDelegate,
     }
     EX_CATCH
     {
-        // It's not even worth asserting, because these aren't our bugs.  At
-        // some point, a MDA may be warranted.
+        // It's not even worth asserting, because these aren't our bugs.
     }
     EX_END_CATCH(SwallowAllExceptions)
 }
@@ -3637,8 +3608,7 @@ void DistributeUnhandledExceptionReliably(OBJECTREF *pDelegate,
     }
     EX_CATCH
     {
-        // It's not even worth asserting, because these aren't our bugs.  At
-        // some point, a MDA may be warranted.
+        // It's not even worth asserting, because these aren't our bugs.
     }
     EX_END_CATCH(SwallowAllExceptions)
 }
index 5877b48..862f469 100644 (file)
@@ -113,12 +113,6 @@ public:
     // get the one single delegate invoke stub
     static PCODE TheDelegateInvokeStub();
 
-#ifdef _TARGET_X86_
-#ifdef MDA_SUPPORTED
-    static Stub *GenerateStubForMDA(MethodDesc *pInvokeMD, MethodDesc *pStubMD, LPVOID pNativeTarget, Stub *pInnerStub);
-#endif // MDA_SUPPORTED
-#endif // _TARGET_X86_
-
     static MethodDesc * __fastcall GetMethodDesc(OBJECTREF obj);
     static OBJECTREF GetTargetObject(OBJECTREF obj);
 
index 89ef589..a527c6e 100644 (file)
@@ -32,7 +32,6 @@
 #include "dllimport.h"
 #include "mlinfo.h"
 #include "dbginterface.h"
-#include "mdaassistants.h"
 #include "sigbuilder.h"
 #include "notifyexternals.h"
 #include "comdelegate.h"
@@ -597,10 +596,6 @@ extern "C" UINT64 __stdcall COMToCLRWorker(Thread *pThread, ComMethodFrame* pFra
         }
     }
 
-    // Check for an illegal coop->coop transition.  We may fire the Reentrancy MDA as a result.
-    if (pThread->PreemptiveGCDisabled())
-        HasIllegalReentrancy();
-
     // Attempt to switch GC modes.  Note that this is performed manually just like in the x86 stub because
     // we have additional checks for shutdown races, MDAs, and thread abort that are performed only when 
     // g_TrapReturningThreads is set.
@@ -612,18 +607,6 @@ extern "C" UINT64 __stdcall COMToCLRWorker(Thread *pThread, ComMethodFrame* pFra
             goto ErrorExit;
     }
 
-#ifdef MDA_SUPPORTED
-    // Check for and trigger the LoaderLock MDA
-    if (ShouldCheckLoaderLock())
-    {
-        BOOL IsHeld;
-        if (AuxUlibIsDLLSynchronizationHeld(&IsHeld) && IsHeld)
-        {
-            MDA_TRIGGER_ASSISTANT(LoaderLock, ReportViolation(0));
-        }
-    }
-#endif // MDA_SUPPORTED
-
     // Initialize the frame's VPTR and GS cookie.
     *((TADDR*)pFrame) = ComMethodFrame::GetMethodFrameVPtr();
     *pFrame->GetGSCookiePtr() = GetProcessGSCookie();
@@ -727,11 +710,6 @@ static UINT64 __stdcall FieldCallWorker(Thread *pThread, ComMethodFrame* pFrame)
     }
     CONTRACTL_END;
 
-
-#ifdef MDA_SUPPORTED
-    MDA_TRIGGER_ASSISTANT(GcUnmanagedToManaged, TriggerGC());
-#endif
-
     LOG((LF_STUBS, LL_INFO1000000, "FieldCallWorker enter\n"));
     
     HRESULT hrRetVal = S_OK;
@@ -767,10 +745,6 @@ static UINT64 __stdcall FieldCallWorker(Thread *pThread, ComMethodFrame* pFrame)
 
     GCPROTECT_END();
 
-#ifdef MDA_SUPPORTED
-    MDA_TRIGGER_ASSISTANT(GcManagedToUnmanaged, TriggerGC());
-#endif
-
     LOG((LF_STUBS, LL_INFO1000000, "FieldCallWorker leave\n"));
 
     return hrRetVal;
index d2d9ef2..40eaea2 100644 (file)
@@ -16,7 +16,6 @@
 
 #include "custommarshalerinfo.h"
 #include "mlinfo.h"
-#include "mdaassistants.h"
 #include "sigbuilder.h"
 
 //==========================================================================
@@ -531,14 +530,6 @@ void CustomMarshalerHelper::InvokeCleanUpNativeMeth(void *pNative)
             ExceptionObj = GET_THROWABLE();
         }
         EX_END_CATCH(SwallowAllExceptions);
-
-#ifdef MDA_SUPPORTED
-        if (ExceptionObj != NULL)
-        {
-            TypeHandle typeCustomMarshaler = GetCustomMarshalerInfo()->GetCustomMarshalerType();
-            MDA_TRIGGER_ASSISTANT(MarshalCleanupError, ReportErrorCustomMarshalerCleanup(typeCustomMarshaler, &ExceptionObj));
-        }
-#endif
     }
     GCPROTECT_END();   
 }
index dd16dd5..b57f5fd 100644 (file)
@@ -26,7 +26,6 @@
 #include "comutilnative.h"
 #include "corhost.h"
 #include "asmconstants.h"
-#include "mdaassistants.h"
 #include "customattribute.h"
 #include "ilstubcache.h"
 #include "typeparse.h"
@@ -628,24 +627,6 @@ public:
                                     (managedReturnElemType == ELEMENT_TYPE_I4) ||
                                     (managedReturnElemType == ELEMENT_TYPE_U4);
 
-#ifdef MDA_SUPPORTED
-        if (!returnTheHRESULT)
-        {
-            MdaExceptionSwallowedOnCallFromCom* mda = MDA_GET_ASSISTANT(ExceptionSwallowedOnCallFromCom);
-            if (mda)
-            {
-                // on the stack: exception object, but the stub linker doesn't know it
-                pcsExceptionHandler->EmitCALL(METHOD__STUBHELPERS__GET_STUB_CONTEXT, 0, 1);
-                pcsExceptionHandler->EmitCALL(METHOD__STUBHELPERS__TRIGGER_EXCEPTION_SWALLOWED_MDA, 
-                    1,  // WARNING: This method takes 2 input args, the exception object and the stub context.
-                        //          But the ILStubLinker has no knowledge that the exception object is on the 
-                        //          stack (because it is unaware that we've just entered a catch block), so we 
-                        //          lie and claim that we only take one input argument.
-                    1); // returns the exception object back
-            }
-        }
-#endif // MDA_SUPPORTED
-
         DWORD retvalLocalNum = m_slIL.GetReturnValueLocalNum();
         BinderMethodID getHRForException;
         if (SF_IsWinRTStub(m_dwStubFlags))
@@ -818,49 +799,6 @@ public:
         }
 #endif // _DEBUG
 
-#ifdef FEATURE_COMINTEROP
-        if (SF_IsForwardCOMStub(m_dwStubFlags))
-        {
-#if defined(MDA_SUPPORTED)
-            // We won't use this NGEN'ed stub if RaceOnRCWCleanup is enabled at run-time
-            if (!SF_IsNGENedStub(m_dwStubFlags))
-            {
-                // This code may change the type of the frame we use, so it has to be run before the code below where we
-                // retrieve the stack arg size based on the frame type.
-                MdaRaceOnRCWCleanup* mda = MDA_GET_ASSISTANT(RaceOnRCWCleanup);
-                if (mda)
-                {
-                    // Here we have to register the RCW of the "this" object to the RCWStack and schedule the clean-up for it.
-                    // Emit a call to StubHelpers::StubRegisterRCW() and StubHelpers::StubUnregisterRCW() to do this.
-                    m_slIL.EmitLoadRCWThis(pcsMarshal, m_dwStubFlags);
-                    pcsMarshal->EmitCALL(METHOD__STUBHELPERS__STUB_REGISTER_RCW, 1, 0);
-
-                    // We use an extra local to track whether we need to unregister the RCW on cleanup
-                    ILCodeStream *pcsSetup = m_slIL.GetSetupCodeStream();
-                    DWORD dwRCWRegisteredLocalNum = pcsSetup->NewLocal(ELEMENT_TYPE_BOOLEAN);
-                    pcsSetup->EmitLDC(0);
-                    pcsSetup->EmitSTLOC(dwRCWRegisteredLocalNum);
-
-                    pcsMarshal->EmitLDC(1);
-                    pcsMarshal->EmitSTLOC(dwRCWRegisteredLocalNum);
-
-                    ILCodeStream *pcsCleanup = m_slIL.GetCleanupCodeStream();
-                    ILCodeLabel *pSkipCleanupLabel = pcsCleanup->NewCodeLabel();
-                    
-                    m_slIL.SetCleanupNeeded();
-                    pcsCleanup->EmitLDLOC(dwRCWRegisteredLocalNum);
-                    pcsCleanup->EmitBRFALSE(pSkipCleanupLabel);
-
-                    m_slIL.EmitLoadRCWThis(pcsCleanup, m_dwStubFlags);
-                    pcsCleanup->EmitCALL(METHOD__STUBHELPERS__STUB_UNREGISTER_RCW, 1, 0);
-
-                    pcsCleanup->EmitLabel(pSkipCleanupLabel);
-                }
-            }
-#endif // MDA_SUPPORTED
-        }
-#endif // FEATURE_COMINTEROP
-
         // <NOTE>
         // The profiler helpers below must be called immediately before and after the call to the target.
         // The debugger trace call helpers are invoked from StubRareDisableWorker
@@ -877,14 +815,6 @@ public:
         }
 #endif // PROFILING_SUPPORTED
 
-#ifdef MDA_SUPPORTED
-        if (SF_IsForwardStub(m_dwStubFlags) && !SF_IsNGENedStub(m_dwStubFlags) &&
-            MDA_GET_ASSISTANT(GcManagedToUnmanaged))
-        {
-            m_slIL.EmitCallGcCollectForMDA(pcsDispatch, m_dwStubFlags);
-        }
-#endif // MDA_SUPPORTED
-
         // For CoreClr, clear the last error before calling the target that returns last error.
         // There isn't always a way to know the function have failed without checking last error,
         // in particular on Unix.
@@ -912,14 +842,6 @@ public:
         }
 #endif // defined(_TARGET_X86_)
 
-#ifdef MDA_SUPPORTED
-        if (SF_IsForwardStub(m_dwStubFlags) && !SF_IsNGENedStub(m_dwStubFlags) &&
-            MDA_GET_ASSISTANT(GcUnmanagedToManaged))
-        {
-            m_slIL.EmitCallGcCollectForMDA(pcsDispatch, m_dwStubFlags);
-        }
-#endif // MDA_SUPPORTED
-
 #ifdef VERIFY_HEAP
         if (SF_IsForwardStub(m_dwStubFlags) && g_pConfig->InteropValidatePinnedObjects())
         {
@@ -2218,28 +2140,8 @@ void NDirectStubLinker::Begin(DWORD dwStubFlags)
     }
     else
     {
-#ifdef MDA_SUPPORTED
-        if (!SF_IsNGENedStub(dwStubFlags) && MDA_GET_ASSISTANT(GcUnmanagedToManaged))
-        {
-            EmitCallGcCollectForMDA(m_pcsSetup, dwStubFlags);
-        }
-#endif // MDA_SUPPORTED
-
         if (SF_IsDelegateStub(dwStubFlags))
         {
-#if defined(MDA_SUPPORTED)
-            // GC was induced (gcUnmanagedToManagedMDA), arguments have been marshaled, and we are about
-            // to touch the UMEntryThunk and extract the delegate target from it so this is the right time
-            // to do the collected delegate MDA check.
-
-            // The call to CheckCollectedDelegateMDA is emitted regardless of whether the MDA is on at the
-            // moment. This is to avoid having to ignore NGENed stubs without the call just as we do for
-            // the GC MDA (callbackOncollectedDelegateMDA is turned on under managed debugger by default
-            // so the impact would be substantial). The helper bails out fast if the MDA is not enabled.
-            EmitLoadStubContext(m_pcsDispatch, dwStubFlags);
-            m_pcsDispatch->EmitCALL(METHOD__STUBHELPERS__CHECK_COLLECTED_DELEGATE_MDA, 1, 0);
-#endif // MDA_SUPPORTED
-
             //
             // recover delegate object from UMEntryThunk
 
@@ -2344,14 +2246,6 @@ void NDirectStubLinker::End(DWORD dwStubFlags)
         m_pcsCleanup->EmitLabel(m_pCleanupFinallyEndLabel);
     }
 
-#ifdef MDA_SUPPORTED
-    if (SF_IsReverseStub(dwStubFlags) && !SF_IsNGENedStub(dwStubFlags) &&
-        MDA_GET_ASSISTANT(GcManagedToUnmanaged))
-    {
-        EmitCallGcCollectForMDA(pcs, dwStubFlags);
-    }
-#endif // MDA_SUPPORTED
-
     if (IsExceptionCleanupNeeded())
     {
         m_pcsExceptionCleanup->EmitLabel(m_pSkipExceptionCleanupLabel);
@@ -2373,7 +2267,7 @@ void NDirectStubLinker::DoNDirect(ILCodeStream *pcsEmit, DWORD dwStubFlags, Meth
         if (SF_IsDelegateStub(dwStubFlags)) // delegate invocation
         {
             // get the delegate unmanaged target - we call a helper instead of just grabbing
-            // the _methodPtrAux field because we may need to intercept the call for host, MDA, etc.
+            // the _methodPtrAux field because we may need to intercept the call for host, etc.
             pcsEmit->EmitLoadThis();
 #ifdef _TARGET_64BIT_
             // on AMD64 GetDelegateTarget will return address of the generic stub for host when we are hosted
@@ -2698,34 +2592,6 @@ void NDirectStubLinker::EmitLoadStubContext(ILCodeStream* pcsEmit, DWORD dwStubF
     }
 }
 
-#ifdef MDA_SUPPORTED
-void NDirectStubLinker::EmitCallGcCollectForMDA(ILCodeStream *pcsEmit, DWORD dwStubFlags)
-{
-    STANDARD_VM_CONTRACT;
-
-    ILCodeLabel *pSkipGcLabel = NULL;
-
-    if (SF_IsForwardPInvokeStub(dwStubFlags) &&
-        !SF_IsDelegateStub(dwStubFlags) &&
-        !SF_IsCALLIStub(dwStubFlags))
-    {
-        // don't call GC if this is a QCall
-        EmitLoadStubContext(pcsEmit, dwStubFlags);
-        pcsEmit->EmitCALL(METHOD__STUBHELPERS__IS_QCALL, 1, 1);
-
-        pSkipGcLabel = pcsEmit->NewCodeLabel();
-        pcsEmit->EmitBRTRUE(pSkipGcLabel);
-    }
-
-    pcsEmit->EmitCALL(METHOD__STUBHELPERS__TRIGGER_GC_FOR_MDA, 0, 0);
-
-    if (pSkipGcLabel != NULL)
-    {
-        pcsEmit->EmitLabel(pSkipGcLabel);
-    }
-}
-#endif // MDA_SUPPORTED
-
 #ifdef FEATURE_COMINTEROP
 
 class DispatchStubState : public StubState // For CLR-to-COM late-bound/eventing calls
@@ -5496,15 +5362,6 @@ MethodDesc* GetStubMethodDescFromInteropMethodDesc(MethodDesc* pMD, DWORD dwStub
     STANDARD_VM_CONTRACT;
 
     BOOL fGcMdaEnabled = FALSE;
-#ifdef MDA_SUPPORTED
-    if (MDA_GET_ASSISTANT(GcManagedToUnmanaged) || MDA_GET_ASSISTANT(GcUnmanagedToManaged))
-    {
-        // We never generate checks for these MDAs to NGEN'ed stubs so if they are
-        // enabled, a new stub must be generated (the perf impact is huge anyway).
-        fGcMdaEnabled = TRUE;
-    }
-#endif // MDA_SUPPORTED
-
 #ifdef FEATURE_COMINTEROP
     if (SF_IsReverseCOMStub(dwStubFlags))
     {
@@ -5529,14 +5386,6 @@ MethodDesc* GetStubMethodDescFromInteropMethodDesc(MethodDesc* pMD, DWORD dwStub
 #ifdef FEATURE_COMINTEROP
     else if (pMD->IsComPlusCall() || pMD->IsGenericComPlusCall())
     {
-#ifdef MDA_SUPPORTED
-        if (MDA_GET_ASSISTANT(RaceOnRCWCleanup))
-        {
-            // we never generate this callout to NGEN'ed stubs
-            return NULL;
-        }
-#endif // MDA_SUPPORTED
-
         if (fGcMdaEnabled)
             return NULL;
 
@@ -5898,10 +5747,6 @@ LPVOID NDirect::NDirectGetEntryPoint(NDirectMethodDesc *pMD, HINSTANCE hMod)
 
     g_IBCLogger.LogNDirectCodeAccess(pMD);
 
-#ifdef MDA_SUPPORTED
-    MDA_TRIGGER_ASSISTANT(PInvokeLog, LogPInvoke(pMD, hMod));
-#endif
-
     RETURN pMD->FindEntryPoint(hMod);
 }
 
@@ -5920,20 +5765,6 @@ VOID NDirectMethodDesc::SetNDirectTarget(LPVOID pTarget)
 
     Stub *pInterceptStub = NULL;
 
-#ifdef _TARGET_X86_
-
-
-#ifdef MDA_SUPPORTED
-    if (!IsQCall() && MDA_GET_ASSISTANT(PInvokeStackImbalance))
-    {
-        pInterceptStub = GenerateStubForMDA(pTarget, pInterceptStub);
-    }
-#endif // MDA_SUPPORTED
-
-
-#endif // _TARGET_X86_
-
-
     NDirectWriteableData* pWriteableData = GetWriteableData();
     EnsureWritablePages(pWriteableData);
     g_IBCLogger.LogNDirectCodeAccess(this);
@@ -5963,29 +5794,6 @@ VOID NDirectMethodDesc::SetNDirectTarget(LPVOID pTarget)
 
 
 
-#if defined(_TARGET_X86_) && defined(MDA_SUPPORTED)
-EXTERN_C VOID __stdcall PInvokeStackImbalanceWorker(StackImbalanceCookie *pSICookie, DWORD dwPostESP)
-{
-    STATIC_CONTRACT_THROWS;
-    STATIC_CONTRACT_GC_TRIGGERS;
-    STATIC_CONTRACT_MODE_PREEMPTIVE; // we've already switched to preemptive
-
-    // make sure we restore the original Win32 last error before leaving this function - we are
-    // called right after returning from the P/Invoke target and the error has not been saved yet
-    BEGIN_PRESERVE_LAST_ERROR;
-
-    MdaPInvokeStackImbalance* pProbe = MDA_GET_ASSISTANT(PInvokeStackImbalance);
-
-    // This MDA must be active if we generated a call to PInvokeStackImbalanceHelper
-    _ASSERTE(pProbe);
-
-    pProbe->CheckStack(pSICookie, dwPostESP);
-
-    END_PRESERVE_LAST_ERROR;
-}
-#endif // _TARGET_X86_ && MDA_SUPPORTED
-
-
 // Preserving good error info from DllImport-driven LoadLibrary is tricky because we keep loading from different places
 // if earlier loads fail and those later loads obliterate error codes.
 //
@@ -6952,18 +6760,6 @@ VOID NDirect::NDirectLink(NDirectMethodDesc *pMD)
         LPVOID pvTarget = NDirectGetEntryPoint(pMD, hmod);
         if (pvTarget)
         {
-
-#ifdef MDA_SUPPORTED
-            MdaInvalidOverlappedToPinvoke *pOverlapCheck = MDA_GET_ASSISTANT(InvalidOverlappedToPinvoke);
-            if (pOverlapCheck && pOverlapCheck->ShouldHook(pMD))
-            {
-                LPVOID pNewTarget = pOverlapCheck->Register(hmod,pvTarget);
-                if (pNewTarget)
-                {
-                    pvTarget = pNewTarget;
-                }
-            }
-#endif
             pMD->SetNDirectTarget(pvTarget);
             fSuccess = TRUE;
         }
index a6967eb..5a3b06f 100644 (file)
@@ -471,9 +471,6 @@ public:
     void    EmitObjectValidation(ILCodeStream* pcsEmit, DWORD dwStubFlags);
 #endif // VERIFY_HEAP
     void    EmitLoadStubContext(ILCodeStream* pcsEmit, DWORD dwStubFlags);
-#ifdef MDA_SUPPORTED
-    void    EmitCallGcCollectForMDA(ILCodeStream *pcsEmit, DWORD dwStubFlags);
-#endif // MDA_SUPPORTED    
     void    GenerateInteropParamException(ILCodeStream* pcsEmit);
     void    NeedsCleanupList();
 
index 50ae49d..806295d 100644 (file)
@@ -20,7 +20,6 @@
 #include "eeconfig.h"
 #include "dbginterface.h"
 #include "stubgen.h"
-#include "mdaassistants.h"
 #include "appdomain.inl"
 
 #ifndef CROSSGEN_COMPILE
@@ -1168,10 +1167,6 @@ VOID UMThunkMarshInfo::RunTimeInit()
     LoaderHeap *pHeap = (pMD == NULL ? NULL : pMD->GetLoaderAllocator()->GetStubHeap());
 
     if (pFinalILStub != NULL ||
-#ifdef MDA_SUPPORTED
-        // GC.Collect calls are emitted to IL stubs
-        MDA_GET_ASSISTANT(GcManagedToUnmanaged) || MDA_GET_ASSISTANT(GcUnmanagedToManaged) ||
-#endif // MDA_SUPPORTED
         NDirect::MarshalingRequired(pMD, GetSignature().GetRawSig(), GetModule()))
     {
         if (pFinalILStub == NULL)
@@ -1210,10 +1205,6 @@ VOID UMThunkMarshInfo::RunTimeInit()
     if (pFinalILStub == NULL)
     {
         if (pMD != NULL && !pMD->IsEEImpl() &&
-#ifdef MDA_SUPPORTED
-            // GC.Collect calls are emitted to IL stubs
-            !MDA_GET_ASSISTANT(GcManagedToUnmanaged) && !MDA_GET_ASSISTANT(GcUnmanagedToManaged) &&
-#endif // MDA_SUPPORTED
             !NDirect::MarshalingRequired(pMD, GetSignature().GetRawSig(), GetModule()))
         {
             // Call the method directly in no-delegate case if possible. This is important to avoid JITing
index 3f02ef0..3d93d32 100644 (file)
@@ -16,7 +16,6 @@
 #include "ceeload.h"
 #include "class.h"
 #include "dllimport.h"
-#include "mdaassistants.h"
 
 enum UMThunkStubFlags
 {
index df53dbf..87bb8bd 100644 (file)
@@ -1036,19 +1036,11 @@ FCFuncStart(gStubHelperFuncs)
     FCFuncElement("GetCOMIPFromRCW_WinRTDelegate", StubHelpers::GetCOMIPFromRCW_WinRTDelegate)
     FCFuncElement("ShouldCallWinRTInterface", StubHelpers::ShouldCallWinRTInterface)
     FCFuncElement("GetTargetForAmbiguousVariantCall", StubHelpers::GetTargetForAmbiguousVariantCall)
-    FCFuncElement("StubRegisterRCW", StubHelpers::StubRegisterRCW)
-    FCFuncElement("StubUnregisterRCW", StubHelpers::StubUnregisterRCW)
     FCFuncElement("GetDelegateInvokeMethod", StubHelpers::GetDelegateInvokeMethod)
     FCFuncElement("GetWinRTFactoryObject", StubHelpers::GetWinRTFactoryObject)
     FCFuncElement("GetWinRTFactoryReturnValue", StubHelpers::GetWinRTFactoryReturnValue)
     FCFuncElement("GetOuterInspectable", StubHelpers::GetOuterInspectable)
-#ifdef MDA_SUPPORTED
-    FCFuncElement("TriggerExceptionSwallowedMDA", StubHelpers::TriggerExceptionSwallowedMDA)
-#endif
 #endif // FEATURE_COMINTEROP
-#ifdef MDA_SUPPORTED
-    FCFuncElement("CheckCollectedDelegateMDA", StubHelpers::CheckCollectedDelegateMDA)
-#endif // MDA_SUPPORTED
 #ifdef PROFILING_SUPPORTED
     FCFuncElement("ProfilerBeginTransitionCallback", StubHelpers::ProfilerBeginTransitionCallback)
     FCFuncElement("ProfilerEndTransitionCallback", StubHelpers::ProfilerEndTransitionCallback)
@@ -1068,9 +1060,6 @@ FCFuncStart(gStubHelperFuncs)
 #ifdef _TARGET_64BIT_
     FCIntrinsic("GetStubContextAddr", StubHelpers::GetStubContextAddr, CORINFO_INTRINSIC_StubHelpers_GetStubContextAddr)
 #endif // _TARGET_64BIT_
-#ifdef MDA_SUPPORTED
-    FCFuncElement("TriggerGCForMDA", StubHelpers::TriggerGCForMDA)
-#endif // MDA_SUPPORTED
 #ifdef FEATURE_ARRAYSTUB_AS_IL
     FCFuncElement("ArrayTypeCheck", StubHelpers::ArrayTypeCheck)
 #endif //FEATURE_ARRAYSTUB_AS_IL
@@ -1229,9 +1218,6 @@ FCClassElement("LoaderAllocatorScout", "System.Reflection", gLoaderAllocatorFunc
 FCClassElement("Marshal", "System.Runtime.InteropServices", gInteropMarshalFuncs)
 FCClassElement("Math", "System", gMathFuncs)
 FCClassElement("MathF", "System", gMathFFuncs)
-#ifdef MDA_SUPPORTED
-FCClassElement("Mda", "System", gMda)
-#endif
 FCClassElement("MdUtf8String", "System", gMdUtf8String)
 FCClassElement("MetadataImport", "System.Reflection", gMetaDataImport)
 FCClassElement("MissingMemberException", "System",  gMissingMemberExceptionFuncs)
index b19e1e4..936d04d 100644 (file)
@@ -4205,19 +4205,6 @@ LONG WatsonLastChance(                  // EXCEPTION_CONTINUE_SEARCH, _CONTINUE_
     switch (tore.GetType())
     {
         case TypeOfReportedError::FatalError:
-            #ifdef MDA_SUPPORTED
-            {
-                MdaFatalExecutionEngineError * pMDA = MDA_GET_ASSISTANT_EX(FatalExecutionEngineError);
-
-                if ((pMDA != NULL) && (pExceptionInfo != NULL) && (pExceptionInfo->ExceptionRecord != NULL))
-                {
-                    TADDR addr = (TADDR) pExceptionInfo->ExceptionRecord->ExceptionAddress;
-                    HRESULT hrError = pExceptionInfo->ExceptionRecord->ExceptionCode;
-                    pMDA->ReportFEEE(addr, hrError);
-                }
-            }
-            #endif // MDA_SUPPORTED
-
             if (pThread != NULL)
             {
                 NotifyDebuggerLastChance(pThread, pExceptionInfo, jitAttachRequested);
index f44f32a..5bab5eb 100644 (file)
@@ -26,7 +26,6 @@
 #include "clsload.hpp"
 #include "cgensys.h"
 #include "virtualcallstub.h"
-#include "mdaassistants.h"
 #include "dllimport.h"
 #include "gcrefmap.h"
 #include "asmconstants.h"
index 5a3e08a..47ff857 100644 (file)
@@ -248,25 +248,6 @@ ASMCONSTANTS_C_ASSERT(SIZEOF_FrameHandlerExRecordWithBarrier == sizeof(FrameHand
 #endif
 
 
-#ifdef MDA_SUPPORTED
-#define SIZEOF_StackImbalanceCookie 0x14
-ASMCONSTANTS_C_ASSERT(SIZEOF_StackImbalanceCookie == sizeof(StackImbalanceCookie))
-
-#define StackImbalanceCookie__m_pMD            0x00
-#define StackImbalanceCookie__m_pTarget        0x04
-#define StackImbalanceCookie__m_dwStackArgSize 0x08
-#define StackImbalanceCookie__m_callConv       0x0c
-#define StackImbalanceCookie__m_dwSavedEsp     0x10
-#define StackImbalanceCookie__HAS_FP_RETURN_VALUE 0x80000000
-
-ASMCONSTANTS_C_ASSERT(StackImbalanceCookie__m_pMD            == offsetof(StackImbalanceCookie, m_pMD))
-ASMCONSTANTS_C_ASSERT(StackImbalanceCookie__m_pTarget        == offsetof(StackImbalanceCookie, m_pTarget))
-ASMCONSTANTS_C_ASSERT(StackImbalanceCookie__m_dwStackArgSize == offsetof(StackImbalanceCookie, m_dwStackArgSize))
-ASMCONSTANTS_C_ASSERT(StackImbalanceCookie__m_callConv       == offsetof(StackImbalanceCookie, m_callConv))
-ASMCONSTANTS_C_ASSERT(StackImbalanceCookie__m_dwSavedEsp     == offsetof(StackImbalanceCookie, m_dwSavedEsp))
-ASMCONSTANTS_C_ASSERT(StackImbalanceCookie__HAS_FP_RETURN_VALUE == StackImbalanceCookie::HAS_FP_RETURN_VALUE)
-#endif // MDA_SUPPORTED
-
 #define MethodDesc_m_wFlags                   DBG_FRE(0x1a, 0x06)
 ASMCONSTANTS_C_ASSERT(MethodDesc_m_wFlags == offsetof(MethodDesc, m_wFlags))
 
index 85a19b8..19697a4 100644 (file)
@@ -51,10 +51,6 @@ EXTERN _UMThunkStubRareDisableWorker@8:PROC
 EXTERN _VarargPInvokeStubWorker@12:PROC
 EXTERN _GenericPInvokeCalliStubWorker@12:PROC
 
-ifdef MDA_SUPPORTED
-EXTERN _PInvokeStackImbalanceWorker@8:PROC
-endif
-
 ifndef FEATURE_CORECLR
 EXTERN _CopyCtorCallStubWorker@4:PROC
 endif
@@ -1284,87 +1280,6 @@ GoCallCalliWorker:
 
 _GenericPInvokeCalliHelper@0 endp
 
-ifdef MDA_SUPPORTED
-
-;==========================================================================
-; Invoked from on-the-fly generated stubs when the stack imbalance MDA is
-; enabled. The common low-level work for both direct P/Invoke and unmanaged
-; delegate P/Invoke happens here. PInvokeStackImbalanceWorker is where the
-; actual imbalance check is implemented.
-; [ESP + 4] - the StackImbalanceCookie
-; [EBP + 8] - stack arguments (EBP frame pushed by the calling stub)
-; 
-_PInvokeStackImbalanceHelper@0 proc public
-    ; StackImbalanceCookie to EBX
-    push    ebx
-    lea     ebx, [esp + 8]
-    
-    push    esi
-    push    edi
-    
-    ; copy stack args
-    mov     edx, ecx
-    mov     ecx, [ebx + StackImbalanceCookie__m_dwStackArgSize]
-    sub     esp, ecx
-
-    shr     ecx, 2
-    lea     edi, [esp]
-    lea     esi, [ebp + 8]
-
-    cld
-    rep movsd
-    
-    ; record pre-call ESP
-    mov     [ebx + StackImbalanceCookie__m_dwSavedEsp], esp
-    
-    ; call the target (restore ECX in case it's a thiscall)
-    mov     ecx, edx
-    call    [ebx + StackImbalanceCookie__m_pTarget]
-
-    ; record post-call ESP and restore ESP to pre-pushed state
-    mov     ecx, esp
-    lea     esp, [ebp - SIZEOF_StackImbalanceCookie - 16] ; 4 DWORDs and the cookie have been pushed
-
-    ; save return value
-    push    eax
-    push    edx
-    sub     esp, 12
-    
-.errnz (StackImbalanceCookie__HAS_FP_RETURN_VALUE AND 00ffffffh), HAS_FP_RETURN_VALUE has changed - update asm code
-    
-    ; save top of the floating point stack if the target has FP retval
-    test    byte ptr [ebx + StackImbalanceCookie__m_callConv + 3], (StackImbalanceCookie__HAS_FP_RETURN_VALUE SHR 24)
-    jz      noFPURetVal
-    fstp    tbyte ptr [esp] ; save full 10 bytes to avoid precision loss
-noFPURetVal:
-
-    ; call PInvokeStackImbalanceWorker(StackImbalanceCookie *pSICookie, DWORD dwPostESP)
-    push    ecx
-    push    ebx
-    call    _PInvokeStackImbalanceWorker@8
-
-    ; restore return value
-    test    byte ptr [ebx + StackImbalanceCookie__m_callConv + 3], (StackImbalanceCookie__HAS_FP_RETURN_VALUE SHR 24)
-    jz      noFPURetValToRestore
-    fld     tbyte ptr [esp]
-noFPURetValToRestore:
-
-    add     esp, 12
-    pop     edx
-    pop     eax
-
-    ; restore registers
-    pop     edi
-    pop     esi
-
-    pop     ebx
-    
-    ; EBP frame and original stack arguments will be removed by the caller
-    ret
-_PInvokeStackImbalanceHelper@0 endp
-
-endif ; MDA_SUPPORTED
-
 ifdef FEATURE_COMINTEROP
 
 ;==========================================================================
index f1bdd0f..b42e422 100644 (file)
@@ -35,11 +35,6 @@ class BaseDomain;
 // CPU-dependent functions
 Stub * GenerateInitPInvokeFrameHelper();
 
-#ifdef MDA_SUPPORTED
-EXTERN_C void STDCALL PInvokeStackImbalanceHelper(void);
-#endif // MDA_SUPPORTED
-
-
 #ifdef FEATURE_STUBS_AS_IL
 EXTERN_C void SinglecastDelegateInvokeStub();
 #endif // FEATURE_STUBS_AS_IL
index 45ac527..df265f2 100644 (file)
@@ -29,7 +29,6 @@
 #include "asmconstants.h"
 #include "class.h"
 #include "virtualcallstub.h"
-#include "mdaassistants.h"
 #include "jitinterface.h"
 
 #ifdef FEATURE_COMINTEROP
@@ -1035,165 +1034,6 @@ Stub *GenerateInitPInvokeFrameHelper()
 }
 
 
-
-#ifdef MDA_SUPPORTED
-
-//-----------------------------------------------------------------------------
-Stub *NDirectMethodDesc::GenerateStubForMDA(LPVOID pNativeTarget, Stub *pInnerStub)
-{
-    STANDARD_VM_CONTRACT;
-
-    CPUSTUBLINKER sl;
-    sl.X86EmitPushEBPframe();
-
-    DWORD callConv = (DWORD)(IsThisCall() ? pmCallConvThiscall : (IsStdCall() ? pmCallConvStdcall : pmCallConvCdecl));
-    _ASSERTE((callConv & StackImbalanceCookie::HAS_FP_RETURN_VALUE) == 0);
-
-    MetaSig msig(this);
-    if (msig.HasFPReturn())
-    {
-        // check for the HRESULT swapping impl flag
-        DWORD dwImplFlags;
-        IfFailThrow(GetMDImport()->GetMethodImplProps(GetMemberDef(), NULL, &dwImplFlags));
-
-        if (dwImplFlags & miPreserveSig)
-        {
-            // pass a flag to PInvokeStackImbalanceHelper that it should save & restore FPU return value
-            callConv |= StackImbalanceCookie::HAS_FP_RETURN_VALUE;
-        }
-    }
-
-    // init StackImbalanceCookie
-    sl.X86EmitPushReg(kEAX);       // m_dwSavedEsp (just making space)
-    sl.X86EmitPushImm32(callConv); // m_callConv
-
-    if (IsVarArgs())
-    {
-        // Re-push the return address as an argument to GetStackSizeForVarArgCall()
-        sl.X86EmitIndexPush(kEBP, 4);
-
-        // This will return the number of stack arguments (in DWORDs)
-        sl.X86EmitCall(sl.NewExternalCodeLabel((LPVOID)GetStackSizeForVarArgCall), 4);
-        
-        // shl eax,2
-        sl.Emit16(0xe0c1);
-        sl.Emit8(0x02);
-        
-        sl.X86EmitPushReg(kEAX); // m_dwStackArgSize
-    }
-    else
-    {
-        sl.X86EmitPushImm32(GetStackArgumentSize()); // m_dwStackArgSize
-    }
-
-    LPVOID pTarget = (pInnerStub != NULL ? (LPVOID)pInnerStub->GetEntryPoint() : pNativeTarget);
-    sl.X86EmitPushImmPtr(pTarget);       // m_pTarget
-    sl.X86EmitPushImmPtr(this);          // m_pMD
-
-    // stack layout at this point
-
-    // |          ...          |
-    // |    stack arguments    | EBP + 8
-    // +-----------------------+
-    // |    return address     | EBP + 4
-    // +-----------------------+
-    // |      saved EBP        | EBP + 0
-    // +-----------------------+
-    // | SIC::m_dwSavedEsp     |
-    // | SIC::m_callConv       |
-    // | SIC::m_dwStackArgSize |
-    // | SIC::m_pTarget        |
-    // | SIC::m_pMD            | EBP - 20
-    // ------------------------
-
-    // call the helper
-    sl.X86EmitCall(sl.NewExternalCodeLabel(PInvokeStackImbalanceHelper), sizeof(StackImbalanceCookie));
-
-    //  pop StackImbalanceCookie
-    sl.X86EmitMovSPReg(kEBP);
-
-    sl.X86EmitPopReg(kEBP);
-    sl.X86EmitReturn((IsStdCall() || IsThisCall()) ? GetStackArgumentSize() : 0);
-
-    if (pInnerStub)
-    {
-        return sl.LinkInterceptor(GetLoaderAllocator()->GetStubHeap(), pInnerStub, pNativeTarget);
-    }
-    else
-    {
-        return sl.Link(GetLoaderAllocator()->GetStubHeap());
-    }
-}
-
-//-----------------------------------------------------------------------------
-// static
-Stub *COMDelegate::GenerateStubForMDA(MethodDesc *pInvokeMD, MethodDesc *pStubMD, LPVOID pNativeTarget, Stub *pInnerStub)
-{
-    STANDARD_VM_CONTRACT;
-
-    WORD wStackArgSize = pStubMD->AsDynamicMethodDesc()->GetNativeStackArgSize();
-
-    // get unmanaged calling convention from pInvokeMD's metadata
-    PInvokeStaticSigInfo sigInfo(pInvokeMD);
-    DWORD callConv = (DWORD)sigInfo.GetCallConv();
-    _ASSERTE((callConv & StackImbalanceCookie::HAS_FP_RETURN_VALUE) == 0);
-
-    MetaSig msig(pInvokeMD);
-    if (msig.HasFPReturn())
-    {
-        // pass a flag to PInvokeStackImbalanceHelper that it should save & restore FPU return value
-        callConv |= StackImbalanceCookie::HAS_FP_RETURN_VALUE;
-    }
-
-    CPUSTUBLINKER sl;
-    sl.X86EmitPushEBPframe();
-
-    LPVOID pTarget = (pInnerStub != NULL ? (LPVOID)pInnerStub->GetEntryPoint() : pNativeTarget);
-
-    // init StackImbalanceCookie
-    sl.X86EmitPushReg(kEAX);             // m_dwSavedEsp (just making space)
-    sl.X86EmitPushImm32(callConv);       // m_callConv
-    sl.X86EmitPushImm32(wStackArgSize);  // m_dwStackArgSize
-    sl.X86EmitPushImmPtr(pTarget);       // m_pTarget
-    sl.X86EmitPushImmPtr(pInvokeMD);     // m_pMD
-
-    // stack layout at this point
-
-    // |          ...          |
-    // |    stack arguments    | EBP + 8
-    // +-----------------------+
-    // |    return address     | EBP + 4
-    // +-----------------------+
-    // |      saved EBP        | EBP + 0
-    // +-----------------------+
-    // | SIC::m_dwSavedEsp     |
-    // | SIC::m_callConv       |
-    // | SIC::m_dwStackArgSize |
-    // | SIC::m_pTarget        |
-    // | SIC::m_pMD            | EBP - 20
-    // ------------------------
-
-    // call the helper
-    sl.X86EmitCall(sl.NewExternalCodeLabel(PInvokeStackImbalanceHelper), sizeof(StackImbalanceCookie));
-
-    //  pop StackImbalanceCookie
-    sl.X86EmitMovSPReg(kEBP);
-
-    sl.X86EmitPopReg(kEBP);
-    sl.X86EmitReturn(callConv == pmCallConvCdecl ? 0 : wStackArgSize);
-
-    if (pInnerStub != NULL)
-    {
-        return sl.LinkInterceptor(pInnerStub, pNativeTarget);
-    }
-    else
-    {
-        return sl.Link(); // don't use loader heap as we want to be able to free the stub
-    }
-}
-
-#endif // MDA_SUPPORTED
-
 extern "C" VOID STDCALL StubRareEnableWorker(Thread *pThread)
 {
     WRAPPER_NO_CONTRACT;
index bb674c2..f46f506 100644 (file)
@@ -3654,37 +3654,6 @@ VOID StubLinkerCPU::EmitDisable(CodeLabel *pForwardRef, BOOL fCallIn, X86Reg Thr
     }
     CONTRACTL_END;
 
-#if defined(FEATURE_COMINTEROP) && defined(MDA_SUPPORTED)
-    // If we are checking whether the current thread is already holds the loader lock, vector
-    // such cases to the rare disable pathway, where we can check again.
-    if (fCallIn && (NULL != MDA_GET_ASSISTANT(Reentrancy)))
-    {
-        CodeLabel   *pNotReentrantLabel = NewCodeLabel();
-
-        // test byte ptr [ebx + Thread.m_fPreemptiveGCDisabled],1
-        X86EmitOffsetModRM(0xf6, (X86Reg)0, ThreadReg, Thread::GetOffsetOfGCFlag());
-        Emit8(1);
-
-        // jz NotReentrant
-        X86EmitCondJump(pNotReentrantLabel, X86CondCode::kJZ);
-        
-        X86EmitPushReg(kEAX);
-        X86EmitPushReg(kEDX);
-        X86EmitPushReg(kECX);
-
-        X86EmitCall(NewExternalCodeLabel((LPVOID) HasIllegalReentrancy), 0);
-
-        // If the probe fires, we go ahead and allow the call anyway.  At this point, there could be
-        // GC heap corruptions.  So the probe detects the illegal case, but doesn't prevent it.
-
-        X86EmitPopReg(kECX);
-        X86EmitPopReg(kEDX);
-        X86EmitPopReg(kEAX);
-
-        EmitLabel(pNotReentrantLabel);
-    }
-#endif
-
     // move byte ptr [ebx + Thread.m_fPreemptiveGCDisabled],1
     X86EmitOffsetModRM(0xc6, (X86Reg)0, ThreadReg, Thread::GetOffsetOfGCFlag());
     Emit8(1);
index d8bb08d..e97b6d9 100644 (file)
@@ -16,7 +16,6 @@
 #include "stdinterfaces.h"
 #include "runtimecallablewrapper.h"
 #include "cominterfacemarshaler.h"
-#include "mdaassistants.h"
 #include "binder.h"
 #include "winrttypenameconverter.h"
 #include "typestring.h"
@@ -437,18 +436,6 @@ void GetObjectRefFromComIP(OBJECTREF* pObjOut, IUnknown **ppUnk, MethodTable *pM
     IUnknown *pUnk = *ppUnk;
     Thread * pThread = GetThread();
 
-#ifdef MDA_SUPPORTED
-    MdaInvalidIUnknown* mda = MDA_GET_ASSISTANT(InvalidIUnknown);
-    if (mda && pUnk)
-    {
-        // Test pUnk
-        SafeComHolder<IUnknown> pTemp;
-        HRESULT hr = SafeQueryInterface(pUnk, IID_IUnknown, &pTemp);
-        if (hr != S_OK)
-            mda->ReportViolation();
-    }
-#endif
-
     *pObjOut = NULL;
     IUnknown* pOuter = pUnk;
     SafeComHolder<IUnknown> pAutoOuterUnk = NULL;
index 11859f5..7b24f9c 100644 (file)
@@ -20,7 +20,6 @@
 #include "interopconverter.h"
 #include "wrappers.h"
 #include "invokeutil.h"
-#include "mdaassistants.h"
 #include "comcallablewrapper.h"
 #include "../md/compiler/custattr.h"
 #include "siginfo.hpp"
@@ -1408,11 +1407,7 @@ ErrExit:
     return hr;
 }
 
-void SafeRelease_OnException(IUnknown* pUnk, RCW* pRCW
-#ifdef MDA_SUPPORTED
-                             , MdaReportAvOnComRelease* pProbe
-#endif // MDA_SUPPORTED
-                             )
+void SafeRelease_OnException(IUnknown* pUnk, RCW* pRCW)
 {
     CONTRACTL
     {
@@ -1422,12 +1417,6 @@ void SafeRelease_OnException(IUnknown* pUnk, RCW* pRCW
     CONTRACTL_END;
 
 #ifndef CROSSGEN_COMPILE
-#ifdef MDA_SUPPORTED
-    // Report the exception that was thrown.
-    if (pProbe) 
-        pProbe->ReportHandledException(pRCW);
-#endif  // MDA_SUPPORTED
-
 #ifdef FEATURE_COMINTEROP
     LogInterop(W("An exception occurred during release"));
     LogInteropLeak(pUnk);
@@ -1457,15 +1446,6 @@ ULONG SafeReleasePreemp(IUnknown * pUnk, RCW * pRCW)
     // Message pump could happen, so arbitrary managed code could run.
     CONTRACT_VIOLATION(ThrowsViolation | FaultViolation);
 
-#ifdef MDA_SUPPORTED
-    // Mode where we just let the fault occur.
-    MdaReportAvOnComRelease* pProbe = MDA_GET_ASSISTANT_EX(ReportAvOnComRelease);
-    if (pProbe && pProbe->AllowAV())
-    {
-        return pUnk->Release();
-    }   
-#endif // MDA_SUPPORTED    
-
     bool fException = false;
     
     SCAN_EHMARKER();
@@ -1500,11 +1480,7 @@ ULONG SafeReleasePreemp(IUnknown * pUnk, RCW * pRCW)
 
     if (fException)
     {
-        SafeRelease_OnException(pUnk, pRCW
-#ifdef MDA_SUPPORTED
-            , pProbe
-#endif // MDA_SUPPORTED
-            );
+        SafeRelease_OnException(pUnk, pRCW);
     }
 
     return res;
@@ -1531,15 +1507,6 @@ ULONG SafeRelease(IUnknown* pUnk, RCW* pRCW)
     // Message pump could happen, so arbitrary managed code could run.
     CONTRACT_VIOLATION(ThrowsViolation | FaultViolation);
 
-#ifdef MDA_SUPPORTED
-    // Mode where we just let the fault occur.
-    MdaReportAvOnComRelease* pProbe = MDA_GET_ASSISTANT_EX(ReportAvOnComRelease);
-    if (pProbe && pProbe->AllowAV())
-    {
-        return pUnk->Release();
-    }   
-#endif // MDA_SUPPORTED    
-
     bool fException = false;
     
     SCAN_EHMARKER();
@@ -1574,11 +1541,7 @@ ULONG SafeRelease(IUnknown* pUnk, RCW* pRCW)
 
     if (fException)
     {
-        SafeRelease_OnException(pUnk, pRCW
-#ifdef MDA_SUPPORTED
-            , pProbe
-#endif // MDA_SUPPORTED
-            );
+        SafeRelease_OnException(pUnk, pRCW);
     }
 
     GCX_PREEMP_NO_DTOR_END();
@@ -4110,10 +4073,6 @@ static void DoIUInvokeDispMethod(IDispatchEx* pDispEx, IDispatch* pDisp, DISPID
 
     memset(&ExcepInfo, 0, sizeof(EXCEPINFO));
    
-#ifdef MDA_SUPPORTED
-    MDA_TRIGGER_ASSISTANT(GcManagedToUnmanaged, TriggerGC());
-#endif
-
     GCX_COOP();
     OBJECTREF pThrowable = NULL;
     GCPROTECT_BEGIN(pThrowable);
@@ -4137,17 +4096,6 @@ static void DoIUInvokeDispMethod(IDispatchEx* pDispEx, IDispatch* pDisp, DISPID
                 }
             }
 
-#ifdef MDA_SUPPORTED
-            EX_TRY
-            {
-                MDA_TRIGGER_ASSISTANT(GcUnmanagedToManaged, TriggerGC());
-            }
-            EX_CATCH
-            {
-            }
-            EX_END_CATCH(RethrowTerminalExceptions);
-#endif
-
             // If the invoke call failed then throw an exception based on the EXCEPINFO.
             if (FAILED(hr))
             {
index 49e343f..91cfd37 100644 (file)
@@ -51,8 +51,6 @@
 #include "gccover.h"
 #endif // HAVE_GCCOVER
 
-#include "mdaassistants.h"
-
 #ifdef FEATURE_PREJIT
 #include "compile.h"
 #include "corcompile.h"
index 5ca4b65..199d896 100644 (file)
@@ -7,6 +7,7 @@
 #include "stringliteralmap.h"
 #include "virtualcallstub.h"
 #include "threadsuspend.h"
+#include "mlinfo.h"
 #ifndef DACCESS_COMPILE
 #include "comdelegate.h"
 #endif
diff --git a/src/vm/mda.h b/src/vm/mda.h
deleted file mode 100644 (file)
index d473cb6..0000000
+++ /dev/null
@@ -1,1513 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-
-#ifndef _MDA_
-#define _MDA_
-
-#ifndef _DEBUG
-#ifdef DACCESS_COMPILE
-#undef MDA_SUPPORTED
-#endif
-#endif
-
-#ifdef MDA_SUPPORTED
-
-#include "sarray.h"
-#include "eeconfig.h"
-// Factory includes
-#include <xmlparser.h>
-#include <objbase.h>
-#include "unknwn.h"
-#include "crst.h"
-#include "../xmlparser/_reference.h"
-#include "../dlls/mscorrc/resource.h"
-
-#define MdaTypeOf(TYPE) ((TYPE*)0)
-#define MdaType(TYPE) (TYPE*)
-#define MdaElemDecl(NAME) MdaElemDecl##NAME
-#define MdaElemDef(NAME) MdaElemDef##NAME
-#define MdaAttrDecl(NAME) MdaAttrDecl##NAME
-
-#define MDA_TARGET_NAMESPACE W("http://schemas.microsoft.com/CLR/2004/10/mda")
-#define MDA_SCHEMA_PREFIX W("mda")
-
-
-class ManagedDebuggingAssistants;
-class MdaAssistant;
-class MdaInvalidConfigFile;
-class MdaXmlElement;
-class MdaXmlAttribute;
-class MdaXmlMessage;
-class MdaXmlIndustry;
-class MdaXPath;
-class MdaSchema;
-class MdaSchemaSchema;
-class MdaAssistantSchema;
-class MdaAssistantMsgSchema;
-class MdaXmlValidationError;
-class MdaFramework;
-template<typename> class MdaFactory;
-
-#define MDA_BUFFER_SIZE 256
-#define MDA_XML_NAME_SIZE 16
-#define MDA_XML_VALUE_SIZE 16
-#define MDA_XML_ELEMENT_CHILDREN 16
-#define MDA_XML_ELEMENT_ATTRIBUTES 16
-#define MDA_MAX_FACTORY_PRODUCT 20
-#define MDA_MAX_STACK_ELEMENTS 20
-#define MDA_MAX_STACK_ATTRIBUTES 20
-
-typedef enum 
-{
-    MdaSchemaPrimitiveBOOL,
-    MdaSchemaPrimitiveSString,
-    MdaSchemaPrimitiveINT32,
-    MdaSchemaPrimitiveUnknown,
-} MdaSchemaPrimitive;
-
-// HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management\PoolTag
-// Hex\Text value
-
-// HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management\PoolTagOverruns
-// 0x0 == Verify Start, 0x1 == VerifyEnd    
-
-#define GFLAG_REG_KEY_PATH W("SYSTEM\\CurrentControlSet\\Control\\Session Manager")
-#define GFLAG_REG_KEY_NAME W("GlobalFlag")
-#define MDA_REG_KEY_PATH FRAMEWORK_REGISTRY_KEY_W 
-#define MDA_REG_KEY_ENABLE W("MdaEnable")
-#define MDA_CONFIG_ENV_VARIABLE W("MDA_CONFIG")
-
-extern const bool g_mdaAssistantIsSwitch[];
-
-typedef enum : BYTE
-{
-#define MDA_DEFINE_ASSISTANT_ENUMERATION
-#include "mdaschema.inl"
-#undef MDA_DEFINE_ASSISTANT_ENUMERATION
-    MdaElemDef(AssistantMax),
-    
-#define MDA_ELEMENT_DEFINITION_ENUMERATION
-#include "mdaschema.inl"
-#undef MDA_ELEMENT_DEFINITION_ENUMERATION
-    MdaElemDef(Max),
-    
-#define MDA_ELEMENT_DECLARAION_ENUMERATION
-#include "mdaschema.inl"
-#undef MDA_ELEMENT_DECLARAION_ENUMERATION
-    MdaElemDecl(Max),
-    MdaElemComment,    
-    MdaElemUndefined,
-    MdaElemEnd,
-} MdaElemDeclDef;
-
-typedef enum 
-{
-#define MDA_ATTRIBUTE_DECLARATION_ENUMERATION
-#include "mdaschema.inl"
-#undef  MDA_ATTRIBUTE_DECLARATION_ENUMERATION
-    MdaAttrDecl(Max),
-    
-    MdaAttrUndefined,
-    MdaAttrEnd,
-} MdaAttrDeclDef;
-
-typedef const SString CSString;
-
-#pragma warning(push)
-#pragma warning(disable:4324)
-
-//
-// MdaStack
-//
-template<typename TYPE>
-class MdaStack
-{
-private:  // MdaStack not for general use. //
-    MdaStack() : m_depth(0) { LIMITED_METHOD_CONTRACT; } 
-    
-public:  // MdaStack not for general use. //
-    void Set(MdaStack<TYPE>* pStack) { WRAPPER_NO_CONTRACT; m_stack.Set(pStack->m_stack); m_depth = pStack->m_depth; }
-    TYPE Push(TYPE element) { WRAPPER_NO_CONTRACT; *m_stack.Append() = element; m_depth++; return Tos(); }
-    TYPE Push() { WRAPPER_NO_CONTRACT; *m_stack.Append(); m_depth++; return Tos(); }
-    TYPE Pop() { WRAPPER_NO_CONTRACT; PRECONDITION(GetDepth() > 0); TYPE tos = Tos(); m_stack.Delete(m_stack.End() - 1); m_depth--; return tos; }
-    TYPE Tos() { WRAPPER_NO_CONTRACT; return m_stack.End()[-1]; }
-    void Clear() { WRAPPER_NO_CONTRACT; while(GetDepth()) Pop(); }
-    COUNT_T GetDepth() { WRAPPER_NO_CONTRACT; return m_depth; }
-    
-private:
-    friend class MdaConfigFactory;
-    friend class ManagedDebuggingAssistants;
-    friend class MdaSchema;
-    friend class MdaXPath;
-    
-private:
-    INT32 m_depth;
-    InlineSArray<TYPE, 16> m_stack;    
-};
-
-
-//
-// MdaHashtable
-//
-BOOL MdaLockOwner(LPVOID);
-
-template<typename TYPE>
-class MdaHashtable
-{
-private:  // MdaHashtable not for general use. //
-    MdaHashtable() { WRAPPER_NO_CONTRACT; LockOwner lockOwner = {NULL, MdaLockOwner}; m_ht.Init(11, &lockOwner); }
-    
-public:  // MdaHashtable not for general use. //
-    TYPE Get(LPCWSTR pKey) { WRAPPER_NO_CONTRACT; StackSString sKey(pKey); return Get(&sKey); }    
-    BOOL Get(LPCWSTR pKey, TYPE* pValue) { WRAPPER_NO_CONTRACT; StackSString sKey(pKey); return Get(&sKey, pValue); }    
-    BOOL HasKey(LPCWSTR pKey) { TYPE value; return Get(pKey, &value); }
-    TYPE Get(CSString* pKey) 
-    { 
-        WRAPPER_NO_CONTRACT;             
-        TYPE value;              
-        ASSERT(Get(pKey, &value));               
-        return value;
-    }
-    BOOL Get(CSString* psszKey, TYPE* pValue) 
-    {
-        WRAPPER_NO_CONTRACT;             
-        EEStringData key(psszKey->GetCount(), psszKey->GetUnicode());
-        HashDatum value;
-        if (m_ht.GetValue(&key, &value))
-        {
-            *pValue = (TYPE)(UINT_PTR)value;
-            return TRUE;
-        }
-        return FALSE;
-    } 
-    void EmptyHashTable() { WRAPPER_NO_CONTRACT; m_ht.EmptyHashTable(); }
-    void DeleteValue(LPCWSTR szKey) 
-    { 
-        WRAPPER_NO_CONTRACT; 
-        StackSString sszKey(szKey); 
-        EEStringData key(sszKey.GetCount(), sszKey.GetUnicode()); 
-        m_ht.DeleteValue(&key); 
-    }
-    DWORD GetCount() { WRAPPER_NO_CONTRACT; return m_ht.GetCount(); }
-        
-    TYPE Set(LPCWSTR pKey, TYPE value) { WRAPPER_NO_CONTRACT; StackSString sszKey(pKey); return Set(&sszKey, value); }
-    TYPE Set(CSString* psszKey, TYPE value) 
-    { 
-        WRAPPER_NO_CONTRACT; 
-        EEStringData key(psszKey->GetCount(), psszKey->GetUnicode()); 
-        m_ht.InsertValue(&key, (HashDatum)value);
-        return value;
-    }
-    
-private:
-    friend class MdaXmlElement;
-    friend class MdaSchema;
-    friend class ManagedDebuggingAssistants;
-    
-private:
-    EEUnicodeStringHashTable m_ht;
-};
-
-
-// 
-
-// MdaEnvironment
-//
-class MdaEnvironment
-{
-public:
-    MdaEnvironment();
-    ~MdaEnvironment();
-    BOOL IsDisabled() { return m_bDisable; }
-    LPCWSTR GetConfigFile() { return m_psszConfigFile->GetUnicode(); }
-    LPCWSTR GetMdaConfigFile() { return m_psszMdaConfigFile->GetUnicode(); }
-    SArray<SString*>& GetActivationMechanisms() { return *m_pGroups; }
-    
-private:
-    LPWSTR m_szMda;
-    MdaFactory<StackSString>* m_pStringFactory;
-    SString* m_psszMdaConfigFile;
-    SString* m_psszConfigFile;
-    BOOL m_bDisable;
-    SArray<SString*>* m_pGroups;
-};
-
-
-// 
-// Mda
-//
-
-// Use these macros if your callsite cannot run on the debugger helper thread.  This is the fastest version.
-#define MDA_GET_ASSISTANT(ASSISTANT) (Mda##ASSISTANT*)ManagedDebuggingAssistants::GetAssistant(MdaElemDef(ASSISTANT))
-#define MDA_TRIGGER_ASSISTANT(ASSISTANT, MEMBER) if (Mda##ASSISTANT* pMdaAssistant = MDA_GET_ASSISTANT(ASSISTANT)) pMdaAssistant->MEMBER
-
-// Use these macros if your callsite might run on the debugger helper thread.  This should be avoided for 
-// very hot checks.
-#define MDA_GET_ASSISTANT_EX(ASSISTANT) (Mda##ASSISTANT*)ManagedDebuggingAssistants::GetAssistantEx(MdaElemDef(ASSISTANT))
-#define MDA_TRIGGER_ASSISTANT_EX(ASSISTANT, MEMBER) if (Mda##ASSISTANT* pMdaAssistant = MDA_GET_ASSISTANT_EX(ASSISTANT)) pMdaAssistant->MEMBER
-
-class ManagedDebuggingAssistants
-{            
-public:
-    FORCEINLINE static MdaAssistant* GetAssistant(MdaElemDeclDef id);
-    FORCEINLINE static MdaAssistant* GetAssistantEx(MdaElemDeclDef id);
-    FORCEINLINE static void          Enable(MdaElemDeclDef assistantDeclDef, MdaAssistant* pMda);
-
-private:  
-    static void AllocateManagedDebuggingAssistants();
-    ManagedDebuggingAssistants();
-    void Initialize();
-#ifdef _DEBUG
-    void DebugInitialize();
-#endif
-
-private:  
-    void SetFwLink(MdaElemDeclDef assistant, LPCWSTR szFwLink) { LIMITED_METHOD_CONTRACT; m_szFwLinks[assistant] = szFwLink; }
-    LPCWSTR GetFwLink(MdaElemDeclDef assistant) { LIMITED_METHOD_CONTRACT; return m_szFwLinks[assistant]; }
-    void ReadAppConfigurationFile(MdaXmlElement* pXmlRoot, SString* pConfigFile, MdaStack<LPCWSTR>* pConfigMdaRoot);
-    MdaXmlElement* GetRootElement(MdaXmlElement* pMdaXmlRoot);
-    void EnvironmentActivation(MdaEnvironment* pEnvironment);
-    void ConfigFileActivation(LPCWSTR szConfigFile, MdaXmlIndustry* pXmlIndustry, MdaHashtable<MdaXmlElement*>* pXmlConfigs);
-    void ActivateGroup(LPCWSTR groupName, SArray<MdaElemDeclDef>* pGroup, MdaHashtable<MdaXmlElement*>* pXmlConfigs);
-    MdaXmlElement* GetSwitchActivationXml(MdaElemDeclDef mda);
-
-public:
-    static BOOL IsDebuggerAttached();
-    static BOOL IsManagedDebuggerAttached();
-    static BOOL IsUnmanagedDebuggerAttached();
-
-private:
-    static void EEStartupActivation();    
-
-private:
-    friend HRESULT EEStartup(DWORD fFlags);
-
-private:
-    friend class MdaAssistant;
-    friend class MdaEnvironment;
-    friend class MdaInvalidConfigFile;
-    friend class MdaSchema;
-    friend class MdaAssistantSchema;
-    friend class MdaAssistantMsgSchema;
-    friend class MdaSchemaSchema;
-    friend class MdaXmlMessage;
-    friend class MdaXmlIndustry;
-    friend class MdaConfigFactory;
-    friend class MdaFramework;
-    friend void EEStartupHelper(COINITIEE fFlags);
-
-private:
-    BOOL GetConfigBool(MdaAttrDeclDef attrDeclDef, MdaElemDeclDef element = MdaElemUndefined, BOOL bDefault = FALSE);
-    BOOL GetConfigBool(MdaAttrDeclDef attrDeclDef, BOOL bDefault) { WRAPPER_NO_CONTRACT; return GetConfigBool(attrDeclDef, MdaElemUndefined, bDefault); }
-
-private:    
-    Crst* m_pLock;
-    BOOL m_bValidateOutput, m_bIsInitialized;
-    LPCWSTR m_szFwLinks[MdaElemDef(AssistantMax)];
-    MdaSchema* m_pAssistantSchema;
-    MdaSchema* m_pAssistantMsgSchema;
-    MdaSchema* m_pSchemaSchema;
-    MdaXmlIndustry* m_pMdaXmlIndustry;
-    MdaXmlElement* m_pSwitchActivationXml;
-};
-
-
-
-typedef VPTR(MdaAssistant) PTR_MdaAssistant;
-
-//
-// MdaAssistant
-//
-class MdaAssistant
-{     
-    friend class ValidateMdaAssistantLayout;
-public:
-    static MdaXmlElement* OutputThread(Thread* pThread, MdaXmlElement* pXml);
-    static MdaXmlElement* OutputParameter(SString parameterName, USHORT sequence, MethodDesc* pMethodDesc, MdaXmlElement* pXml);
-    static MdaXmlElement* OutputMethodTable(MethodTable* pMT, MdaXmlElement* pXml);
-    static MdaXmlElement* OutputMethodDesc(MethodDesc* pMethodDesc, MdaXmlElement* pXml);
-    static MdaXmlElement* OutputFieldDesc(FieldDesc* pFieldDesc, MdaXmlElement* pXml);
-    static MdaXmlElement* OutputTypeHandle(TypeHandle typeHandle, MdaXmlElement* pXml);
-    static MdaXmlElement* OutputModule(Module* pModule, MdaXmlElement* pXml);
-    static MdaXmlElement* OutputCallsite(MethodDesc *pMethodDesc, DWORD dwOffset, MdaXmlElement* pXml);
-    static MdaXmlElement* OutputException(OBJECTREF *pExceptionObj, MdaXmlElement* pXml);
-
-public:
-    static SString& ToString(SString& sszBuffer, Module* pModule); 
-    static SString& ToString(SString& sszBuffer, TypeHandle typeHandle); 
-    static SString& ToString(SString& sszBuffer, MethodDesc* pMethodDesc); 
-    static SString& ToString(SString& sszBuffer, FieldDesc* pFieldDesc); 
-    static void ToString(TypeHandle typeHandle, SString* psszFullname, SString* psszNamespace);
-    
-public:
-    LPCWSTR GetName();
-    
-private:
-    void Initialize(MdaXmlElement* pXmlInput);
-    static BOOL IsAssistantActive(MdaXmlElement* pXml); 
-    
-private:
-    bool GetSuppressDialog() { LIMITED_METHOD_CONTRACT; return m_bSuppressDialog; }
-    MdaElemDeclDef GetAssistantDeclDef() { LIMITED_METHOD_CONTRACT; return m_assistantDeclDef; }
-    MdaElemDeclDef GetAssistantMsgDeclDef() { LIMITED_METHOD_CONTRACT; return m_assistantMsgDeclDef; }
-    MdaXmlElement* GetRootElement(MdaXmlElement* pMdaXmlRoot, BOOL bBreak);
-
-private:
-    friend class ManagedDebuggingAssistants;
-    friend class MdaXmlMessage;
-    
-private:
-    // WARNING: do not modify the field layout without also 
-    // modifying the MDA_ASSISTANT_BASE_MEMBERS macro.
-    MdaElemDeclDef m_assistantDeclDef;
-    MdaElemDeclDef m_assistantMsgDeclDef;
-    bool m_bSuppressDialog; 
-};
-
-//
-// MdaXmlAttribute 
-//
-class MdaXmlAttribute
-{
-public:
-    LPCWSTR GetName();
-    LPCWSTR GetValue() { LIMITED_METHOD_CONTRACT; PRECONDITION(CheckPointer(this)); return m_value.GetUnicode(); } 
-    LPCWSTR GetValueAsUnicode() { LIMITED_METHOD_CONTRACT; PRECONDITION(CheckPointer(this)); return GetValueAsCSString()->GetUnicode(); } 
-    SString* GetValueAsCSString() { LIMITED_METHOD_CONTRACT; PRECONDITION(CheckPointer(this)); return &m_value; } 
-    BOOL GetValueAsBool() { LIMITED_METHOD_CONTRACT; PRECONDITION(CheckPointer(this)); ASSERT(m_type == MdaSchemaPrimitiveBOOL); return m_bool; }
-    INT32 GetValueAsInt32() { LIMITED_METHOD_CONTRACT; PRECONDITION(CheckPointer(this)); ASSERT(m_type == MdaSchemaPrimitiveINT32); return m_int; }
-    MdaAttrDeclDef GetDeclDef() { LIMITED_METHOD_CONTRACT; PRECONDITION(CheckPointer(this)); return m_declDef; }
-    
-private:      
-    SString* ToXml(SString* xml);
-
-    MdaXmlAttribute* Initialize(LPCWSTR szName, LPCWSTR szValue);
-    
-    MdaXmlAttribute* SetSString(LPCUTF8 szValue) { WRAPPER_NO_CONTRACT; m_type = MdaSchemaPrimitiveSString; m_value.SetUTF8(szValue); return this; }
-    MdaXmlAttribute* SetSString(LPCWSTR szValue) { WRAPPER_NO_CONTRACT; m_type = MdaSchemaPrimitiveSString; m_value.Set(szValue); return this; }
-    MdaXmlAttribute* SetDeclDef(MdaAttrDeclDef declDef) { WRAPPER_NO_CONTRACT; m_declDef = declDef; return this; }
-    MdaXmlAttribute* SetNs(LPCWSTR szNs) { WRAPPER_NO_CONTRACT; m_szNs.Set(szNs); return this; } 
-    MdaXmlAttribute* SetINT32(INT32 value) { LIMITED_METHOD_CONTRACT; m_type = MdaSchemaPrimitiveINT32; m_int = value; return this; }
-    MdaXmlAttribute* SetBOOL(BOOL value) { LIMITED_METHOD_CONTRACT; m_type = MdaSchemaPrimitiveBOOL; m_bool = value; return this; }
-
-private:
-    friend class ManagedDebuggingAssistants;
-    friend class MdaConfigFactory;
-    friend class MdaSchemaSchema;
-    friend class MdaXmlElement;
-    friend class MdaSchema;
-    friend class MdaXmlMessage;
-    template<typename PRODUCT> friend class MdaFactory;
-
-private:
-    MdaAttrDeclDef m_declDef;
-    SString m_szName;
-    SString m_szNs;
-    MdaSchemaPrimitive m_type;
-    SString m_value;
-    BOOL m_bool;
-    INT32 m_int;
-};
-
-
-//
-// MdaXmlElement
-//
-class MdaXmlElement
-{
-public: /* inspection */  
-    LPCWSTR GetName();
-    MdaElemDeclDef GetDeclDef() { LIMITED_METHOD_CONTRACT; return m_elemDeclDef; }
-    BOOL IsDefinition() { LIMITED_METHOD_CONTRACT; return m_elemDeclDef < MdaElemDef(Max); }
-    BOOL IsDeclaration() { LIMITED_METHOD_CONTRACT; return !IsDefinition(); }
-    SArray<MdaXmlElement*>& GetChildren() { LIMITED_METHOD_CONTRACT; return m_children; }
-    MdaXmlElement* GetChild(MdaElemDeclDef declDef);
-    SArray<MdaXmlAttribute*>& GetAttributes() { LIMITED_METHOD_CONTRACT; return m_attributes; }
-    MdaXmlAttribute* GetAttribute(MdaAttrDeclDef attrDeclDef);
-    BOOL GetAttributeValueAsBool(MdaAttrDeclDef attrDeclDef, BOOL bDefault);
-    BOOL GetAttributeValueAsBool(MdaAttrDeclDef attrDeclDef);
-    
-public: /* creation */
-    MdaXmlElement* SetDeclDef(MdaElemDeclDef elemDeclDef) { LIMITED_METHOD_CONTRACT; m_elemDeclDef = elemDeclDef; return this; }
-    MdaXmlElement* SetName(LPCWSTR name, BOOL bAssertDefined = TRUE);
-    MdaXmlElement* AddChild(LPCWSTR name, BOOL bAssertDefined = TRUE);
-    MdaXmlElement* AddChild(MdaElemDeclDef type);
-    void AddChildComment(LPCWSTR szComment) { WRAPPER_NO_CONTRACT; AddChild(MdaElemComment)->m_szName.Set(szComment); }   
-    LPCWSTR DebugToString(SString* pBuffer);
-    
-    template<typename ATTRIBUTE_TYPE>
-    MdaXmlAttribute* AddAttributeSz(MdaAttrDeclDef declDef, ATTRIBUTE_TYPE szValue) { return AddAttribute(declDef)->SetSString(szValue); }
-    MdaXmlAttribute* AddAttributeInt(MdaAttrDeclDef declDef, INT32 value) { return AddAttribute(declDef)->SetINT32(value); }
-    MdaXmlAttribute* AddAttributeBool(MdaAttrDeclDef declDef, BOOL bValue) { return AddAttribute(declDef)->SetBOOL(bValue); }
-         
-private:
-    MdaXmlElement() : m_elemDeclDef(MdaElemUndefined), m_defaultAttrIndex(-1) { WRAPPER_NO_CONTRACT; }
-    MdaXmlElement* AddChild(MdaXmlElement* pChild); 
-
-    MdaXmlElement* SetIndustry(MdaXmlIndustry* pXmlIndustry)
-        { LIMITED_METHOD_CONTRACT; PRECONDITION(CheckPointer(pXmlIndustry, NULL_OK)); m_pXmlIndustry = pXmlIndustry; return this; }
-
-    MdaXmlAttribute* AddDefaultAttribute(MdaAttrDeclDef attrDeclDef, LPCWSTR szValue); 
-    MdaXmlAttribute* AddAttribute(LPCWSTR szName, LPCWSTR szValue);
-
-    SString* ToXml(SString* xml) { WRAPPER_NO_CONTRACT; return ToXml(xml, NULL, 0); }
-    SString* ToXml(SString* xml, LPCWSTR ns) { WRAPPER_NO_CONTRACT; return ToXml(xml, ns, 0); }
-    SString* ToXml(SString* xml, LPCWSTR ns, INT32 depth);
-
-    MdaXmlAttribute* AddAttribute(MdaAttrDeclDef declDef);
-    MdaXmlAttribute* AddAttribute(MdaXmlAttribute* pAttr) { WRAPPER_NO_CONTRACT; *m_attributes.Append() = pAttr; return pAttr; }
-    
-private:
-    friend class MdaSchema;
-    friend class ManagedDebuggingAssistants;
-    friend class MdaXmlMessage;
-    friend class MdaXmlElement;
-    template<typename PRODUCT> friend class MdaFactory;
-    friend class MdaXmlIndustry;    
-    friend class MdaConfigFactory;    
-    friend class MdaSchemaSchema;
-    friend class MdaXmlValidationError;
-    
-private:
-    MdaXmlIndustry* m_pXmlIndustry;
-    MdaElemDeclDef m_elemDeclDef;
-    SString m_szName;
-    InlineSArray<MdaXmlElement*, MDA_XML_ELEMENT_CHILDREN> m_children;
-    COUNT_T m_defaultAttrIndex;
-    InlineSArray<MdaXmlAttribute*, MDA_XML_ELEMENT_ATTRIBUTES>  m_attributes;
-};
-
-
-//
-// MdaFactory 
-//
-template<typename PRODUCT>
-class MdaFactory
-{
-public:
-    MdaFactory() : m_cProduct(0), m_next(NULL) { LIMITED_METHOD_CONTRACT; }
-    ~MdaFactory() { LIMITED_METHOD_CONTRACT; if (m_next) delete m_next; } 
-    MdaFactory* GetNext() { if (!m_next) m_next = new MdaFactory<PRODUCT>(); return m_next; }   
-    PRODUCT* Create();
-
-private:
-    MdaFactory* m_next;
-    PRODUCT m_product[MDA_MAX_FACTORY_PRODUCT];
-    INT32 m_cProduct;
-};
-
-
-//
-// MdaXmlIndustry
-//
-class MdaXmlIndustry
-{
-public:
-    MdaXmlElement* CreateElement() { WRAPPER_NO_CONTRACT; return m_elements.Create()->SetIndustry(this); }
-    MdaXmlAttribute* CreateAttribute() { WRAPPER_NO_CONTRACT; return m_attributes.Create(); }
-      
-private:
-    MdaFactory<MdaXmlElement> m_elements;
-    MdaFactory<MdaXmlAttribute> m_attributes;
-    
-private:
-    friend class MdaConfigFactory;
-    friend class MdaFramework;
-    friend class MdaXmlMessage;
-    friend class ManagedDebuggingAssistants;
-    friend class MdaXmlElement;
-    friend class MdaXmlAttribute;
-    friend class MdaSchema;
-};
-
-
-//
-// MdaXmlMessage 
-//
-class MdaXmlMessage
-{
-public:
-    MdaXmlMessage(MdaXmlElement** ppMdaXmlRoot);   
-    MdaXmlMessage(MdaAssistant* pAssistant, BOOL bBreak, MdaXmlElement** ppMdaXmlRoot);
-
-public:
-    void SendMessage();
-    void SendMessage(int resourceID); 
-    void SendMessage(LPCWSTR szMessage); 
-    void SendMessagef(int resourceID, ...); 
-    
-private:
-    static BOOL IsDebuggerAttached() { WRAPPER_NO_CONTRACT; return ManagedDebuggingAssistants::IsDebuggerAttached(); }
-    static BOOL IsManagedDebuggerAttached() { WRAPPER_NO_CONTRACT; return ManagedDebuggingAssistants::IsManagedDebuggerAttached(); }
-    static BOOL IsUnmanagedDebuggerAttached() { WRAPPER_NO_CONTRACT; return ManagedDebuggingAssistants::IsUnmanagedDebuggerAttached(); }
-    static BOOL ShouldLogToManagedDebugger();
-    
-private:
-    void SendEvent();
-    void SendHostEvent();
-    void SendDebugEvent();
-
-private:
-    friend class ManagedDebuggingAssistants;
-    friend class MdaFramework;
-    
-private:
-    BOOL m_bBreak;
-    MdaAssistant* m_pMdaAssistant;
-    SString m_localizedMessage;
-    SString m_englishMessage;
-    MdaXmlElement* m_pMdaXmlRoot;
-    MdaXmlElement* m_pAssistantXmlRoot;
-    MdaXmlIndustry m_mdaXmlIndustry;
-};
-
-
-//
-// MdaXPath 
-//
-class MdaXPath
-{
-public:
-    static SArray<MdaXmlElement*>* FindElements(MdaXmlElement* pRoot, LPCWSTR szQuery, SArray<MdaXmlElement*>* pResult)
-        { WRAPPER_NO_CONTRACT; MdaXPath query(szQuery); return query.FindElements(pRoot, pResult); }
-    static MdaXmlElement* FindElement(MdaXmlElement* pRoot, LPCWSTR szQuery)
-        { WRAPPER_NO_CONTRACT; MdaXPath query(szQuery); return query.FindElement(pRoot); }
-    static SArray<MdaXmlAttribute*>* FindAttributes(MdaXmlElement* pRoot, LPCWSTR szQuery, SArray<MdaXmlAttribute*>* pResult)
-        { WRAPPER_NO_CONTRACT; MdaXPath query(szQuery); return query.FindAttributes(pRoot, pResult); }
-    static MdaXmlAttribute* FindAttribute(MdaXmlElement* pRoot, LPCWSTR szQuery)
-        { WRAPPER_NO_CONTRACT; MdaXPath query(szQuery); return query.FindAttribute(pRoot); }
-
-public:
-    MdaXPath() : m_cArgs(NOT_VARIABLE), m_pCompiledQuery(NULL) { WRAPPER_NO_CONTRACT; }
-    MdaXPath(LPCWSTR xpath) : m_cArgs(NOT_VARIABLE) { WRAPPER_NO_CONTRACT; Initialize(xpath); }
-    MdaXPath* Initialize(LPCWSTR xpath) { WRAPPER_NO_CONTRACT; m_xpath.Set(xpath); MdaXPathCompiler(this, &m_pCompiledQuery); return this; }
-    MdaXmlElement* FindElement(MdaXmlElement* pRoot, ...); 
-    MdaXmlAttribute* FindAttribute(MdaXmlElement* pRoot, ...); 
-    SArray<MdaXmlElement*>* FindElements(MdaXmlElement* pRoot, SArray<MdaXmlElement*>* pResult, ...); 
-    SArray<MdaXmlAttribute*>* FindAttributes(MdaXmlElement* pRoot, SArray<MdaXmlAttribute*>* pResult, ...);    
-    COUNT_T GetArgCount() { LIMITED_METHOD_CONTRACT; return m_cArgs + 1; }
-    
-private:   
-    class MdaXPathBase; 
-    class MdaXPathElement;
-    class MdaXPathAttribute;    
-    class MdaXPathResult;
-    class MdaXPathLogicalOp;
-
-    typedef enum
-    {
-        XPathVarAttrBool = MdaSchemaPrimitiveBOOL,
-        XPathVarAttrSString = MdaSchemaPrimitiveSString,
-        XPathVarAttrINT32 = MdaSchemaPrimitiveINT32,
-        XPathVarElemDeclDef = XPathVarAttrINT32 + 1,
-        XPathVarAttrDeclDef = XPathVarAttrINT32 + 2,
-    } XPathVarType;
-    
-    typedef struct 
-    {
-        union
-        {
-            MdaElemDeclDef m_elemDeclDef;
-            MdaAttrDeclDef m_attrDeclDef;
-            BOOL m_bool;
-            SString* m_pSstr;
-            INT32 m_int32;
-        } m_u;
-    } MdaXPathVariable;
-
-private:  
-    void Find(SArray<MdaXPathVariable>& args, SString* pWildCard, va_list argItr);
-    static const COUNT_T NOT_VARIABLE = -1;
-
-private:  
-    class MdaXPathResult
-    {
-    public:
-        MdaXPathResult(SArray<MdaXPathVariable>* args) { LIMITED_METHOD_CONTRACT; Initialize(args); }
-        MdaXPathResult(SArray<MdaXmlElement*>* pElements, SArray<MdaXPathVariable>* args) { WRAPPER_NO_CONTRACT; Initialize(args); m_pElements = pElements; }
-        MdaXPathResult(SArray<MdaXmlAttribute*>* pAttributes, SArray<MdaXPathVariable>* args) { WRAPPER_NO_CONTRACT; Initialize(args); m_pAttributes = pAttributes; }
-        void Initialize(SArray<MdaXPathVariable>* args) { LIMITED_METHOD_CONTRACT; m_args = args; m_pElements = NULL; m_pAttributes = NULL; m_pElement = NULL; m_pAttribute = NULL; m_bIsRoot = TRUE; } 
-        MdaXmlElement* GetXmlElement() { LIMITED_METHOD_CONTRACT; return m_pElement; }
-        MdaXmlAttribute* GetXmlAttribute() { LIMITED_METHOD_CONTRACT; return m_pAttribute; }
-
-        void AddMatch(MdaXmlAttribute* pMatch) 
-            { LIMITED_METHOD_CONTRACT; if (m_pAttributes) m_pAttributes->Append((MdaXmlAttribute*)pMatch); else { ASSERT(!m_pAttribute); m_pAttribute = pMatch; } }
-        void AddMatch(MdaXmlElement* pMatch) 
-            { LIMITED_METHOD_CONTRACT; if (m_pElements) m_pElements->Append((MdaXmlElement*)pMatch); else { ASSERT(!m_pElement); m_pElement = pMatch; } }
-        BOOL IsRoot() { LIMITED_METHOD_CONTRACT; if (!m_bIsRoot) return FALSE; m_bIsRoot = FALSE; return TRUE; }
-        SArray<MdaXPathVariable>& GetArgs() { LIMITED_METHOD_CONTRACT; return *m_args; }
-        
-    private:
-        BOOL m_bIsRoot;
-        SArray<MdaXPathVariable>* m_args;
-        SArray<MdaXmlElement*>* m_pElements;
-        SArray<MdaXmlAttribute*>* m_pAttributes;
-        MdaXmlElement* m_pElement;
-        MdaXmlAttribute* m_pAttribute;
-    };
-    
-    class MdaXPathCompiler
-    {
-    public:
-        MdaXPathCompiler(MdaXPath* pXPath, MdaXPathBase** ppCompiledQuery) 
-            : m_pXPath(pXPath) { WRAPPER_NO_CONTRACT; m_itr = pXPath->m_xpath.Begin(); NextToken(); *ppCompiledQuery = XPATH(); }
-
-    private:
-        typedef enum {
-            //
-            // TOKENS
-            //
-            MdaXPathIdentifier          = 0x0001,
-            MdaXPathDot                 = 0x0002,
-            MdaXPathSlash               = 0x0004,
-            MdaXPathAstrix              = 0x0008,
-            MdaXPathQuotedString        = 0x0010,
-            MdaXPathOpenParen           = 0x0020,
-            MdaXPathCloseParen          = 0x0040,
-            MdaXPathOpenSqBracket       = 0x0080,
-            MdaXPathCloseSqBracket      = 0x0100,
-            MdaXPathLogicalAnd          = 0x0200,
-            MdaXPathLogicalOr           = 0x0400,
-            MdaXPathEquals              = 0x0800,
-            MdaXPathAtSign              = 0x1000,         
-            MdaXPathQMark               = 0x2000,         
-            MdaXPathEnd                 = 0x4000,
-
-            //
-            // 1 TOKEN LOOK AHEAD 
-            //
-            MdaXPathSTART               = MdaXPathSlash,
-            MdaXPathXPATH               = MdaXPathSlash,
-            MdaXPathATTRIBUTE           = MdaXPathAtSign,
-            MdaXPathATTRIBUTE_FILTER    = MdaXPathAtSign,
-            MdaXPathELEMENT             = MdaXPathIdentifier | MdaXPathAstrix | MdaXPathQMark,
-            MdaXPathELEMENT_EXPR        = MdaXPathELEMENT,
-            MdaXPathFILTER              = MdaXPathELEMENT_EXPR | MdaXPathATTRIBUTE_FILTER,
-            MdaXPathFILTER_EXPR         = MdaXPathFILTER | MdaXPathOpenParen,
-        } MdaXPathTokens;
-
-    //
-    // LEXIFIER 
-    //
-    private:
-        MdaXPathTokens LexAToken();
-        void NextToken()  { WRAPPER_NO_CONTRACT; m_currentToken = LexAToken(); }
-        BOOL TokenIs(MdaXPathTokens token) { LIMITED_METHOD_CONTRACT; return !!(m_currentToken & token); }
-        BOOL TokenIs(int token) { LIMITED_METHOD_CONTRACT; return TokenIs((MdaXPathTokens)token); }
-        LPCWSTR GetIdentifier() { WRAPPER_NO_CONTRACT; return m_identifier.GetUnicode(); }
-        
-    //
-    // PRODUCTIONS
-    //
-    private: 
-        MdaXPathBase* XPATH();
-        //  '/' ATTRIBUTE end
-        //  '/' ELEMENT_EXPR XPATH
-        //  '/' ELEMENT_EXPR end
-        
-        MdaXPathAttribute* ATTRIBUTE();
-        //  '@' id
-        //  '@' '?'
-        
-        MdaXPathElement* ELEMENT();
-        //  id
-        //  '*'
-        //  '?'
-        
-        MdaXPathElement* ELEMENT_EXPR();
-        //  ELEMENT '[' FILTER_EXPR ']'
-        //  ELEMENT 
-        
-        MdaXPathBase* FILTER_EXPR();
-        //  FILTER
-        //  '(' FILTER ')'
-        //  FILTER '&' FILTER
-        //  FILTER '|' FILTER
-                
-        MdaXPathBase* FILTER();
-        //  ELEMENT_EXPR
-        //  ATTRIBUTE_FILTER
-        //  ELEMENT_EXPR ATTRIBUTE_FILTER
-        
-        MdaXPathAttribute* ATTRIBUTE_FILTER();
-        //  ATTRIBUTE
-        //  ATTRIBUTE '=' ''' id '''
-        //  ATTRIBUTE '=' '?'
-        
-    private:
-        MdaXPath* m_pXPath;
-        SString::CIterator m_itr;
-        StackSString m_identifier;
-        MdaXPathTokens m_currentToken;
-    };
-
-    class MdaXPathBase 
-    {
-    public:
-        virtual BOOL Run(MdaXmlElement* pElement, MdaXPathResult* pResult) = 0;
-        virtual BOOL IsXPathAttribute() { LIMITED_METHOD_CONTRACT; return FALSE; }
-
-    private:
-    };
-    
-    class MdaXPathElement : public MdaXPathBase 
-    {
-    public:
-        virtual BOOL Run(MdaXmlElement* pElement, MdaXPathResult* pResult);
-        BOOL RunOnChild(MdaXmlElement* pElement, MdaXPathResult* pResult);
-        
-    public:
-        MdaXPathElement() : m_name(MdaElemUndefined), m_nameArg(NOT_VARIABLE), m_bIsTarget(FALSE), m_pChild(NULL), m_pQualifier(NULL) { LIMITED_METHOD_CONTRACT; }
-        MdaXPathBase* MarkAsTarget() { LIMITED_METHOD_CONTRACT; m_bIsTarget = TRUE; return this; };
-        MdaXPathElement* SetChild(MdaXPathBase* pChild) { LIMITED_METHOD_CONTRACT; m_pChild = pChild; return this; }
-        MdaXPathElement* SetQualifier(MdaXPathBase* pQualifier) { LIMITED_METHOD_CONTRACT; m_pQualifier = pQualifier; return this; }
-        MdaXPathElement* Initialize() { LIMITED_METHOD_CONTRACT; return this; }
-        MdaXPathElement* Initialize(MdaElemDeclDef identifier) { LIMITED_METHOD_CONTRACT; m_name = identifier; return this; }
-        MdaXPathElement* Initialize(COUNT_T identifier) { LIMITED_METHOD_CONTRACT; m_nameArg = identifier; return this; }
-        
-    private:
-        MdaElemDeclDef m_name;
-        COUNT_T m_nameArg;
-        BOOL m_bIsTarget;       
-        MdaXPathBase* m_pChild;
-        MdaXPathBase* m_pQualifier;
-    };
-    
-    class MdaXPathAttribute : public MdaXPathBase 
-    {
-    public:
-        MdaXPathAttribute() : m_name(MdaAttrUndefined), m_nameArg(NOT_VARIABLE), m_valueArg(NOT_VARIABLE) { WRAPPER_NO_CONTRACT; }
-        virtual BOOL Run(MdaXmlElement* pElement, MdaXPathResult* pResult);
-        virtual BOOL IsXPathAttribute() { LIMITED_METHOD_CONTRACT; return TRUE; }
-
-    public:
-        MdaXPathBase* MarkAsTarget() { LIMITED_METHOD_CONTRACT; m_bIsTarget = TRUE; return this; };
-        MdaXPathAttribute* SetName(MdaAttrDeclDef name) { WRAPPER_NO_CONTRACT; m_name = name; return this; }
-        MdaXPathAttribute* SetValue(LPCWSTR value) { WRAPPER_NO_CONTRACT; m_value.Set(value); return this; }
-        MdaXPathAttribute* SetName(COUNT_T name) { WRAPPER_NO_CONTRACT; m_nameArg = name; return this; }
-        MdaXPathAttribute* SetValue(COUNT_T value) { WRAPPER_NO_CONTRACT; m_valueArg = value; return this; }
-        
-    private:
-        BOOL m_bIsTarget;       
-        MdaAttrDeclDef m_name;
-        COUNT_T m_nameArg;
-        SString m_value;
-        COUNT_T m_valueArg;
-    };
-    
-    class MdaXPathLogicalOp : public MdaXPathBase 
-    {
-    public:
-        virtual BOOL Run(MdaXmlElement* pElement, MdaXPathResult* pResult);
-        
-    public:
-        MdaXPathLogicalOp* Initialize(BOOL andOp, MdaXPathBase* pLhs, MdaXPathBase* pRhs)
-            { LIMITED_METHOD_CONTRACT; m_andOp = andOp; m_pLhs = pLhs; m_pRhs = pRhs; return this; }
-               
-    private:
-        BOOL m_andOp;
-        MdaXPathBase* m_pLhs;
-        MdaXPathBase* m_pRhs;
-    };     
-    
-private:
-    COUNT_T m_cArgs;
-    InlineSArray<XPathVarType, 20> m_argTypes;
-    StackSString m_xpath;
-    MdaXPathBase* m_pCompiledQuery;
-    MdaFactory<MdaXPathElement> m_elementFactory;
-    MdaFactory<MdaXPathAttribute> m_attrFactory;
-    MdaFactory<MdaXPathLogicalOp> m_logicalOpFactory;  
-};
-
-
-//
-// MdaSchema 
-//
-class MdaSchema
-{
-private:
-    static void Initialize();
-
-public:
-//     SPTR_DECL(RangeSection, m_RangeTree);
-//     SPTR_IMPL(RangeSection, ExecutionManager, m_RangeTree);
-
-    static MdaElemDeclDef GetElementType(LPCWSTR name, BOOL bAssertDefined = TRUE);
-    static LPCWSTR GetElementName(MdaElemDeclDef type);
-    static MdaAttrDeclDef GetAttributeType(LPCWSTR name, BOOL bAssertDefined = TRUE);
-    static LPCWSTR GetAttributeName(MdaAttrDeclDef type);
-
-public:
-    static LPCWSTR g_arElementNames[MdaElemEnd];
-
-private:
-    static LPCWSTR g_arAttributeNames[MdaAttrEnd];
-    static MdaFactory<SString>* g_pSstringFactory;
-    static MdaHashtable<MdaElemDeclDef>* g_pHtElementType;
-    static MdaHashtable<MdaAttrDeclDef>* g_pHtAttributeType;
-    static LPCWSTR ToLowerFirstChar(LPCWSTR name);
-
-private:
-    class MdaSchemaBase;
-    class MdaSchemaAttribute;
-    class MdaSchemaSequence;
-    class MdaSchemaChoice;
-    class MdaSchemaComplexType;
-    class MdaSchemaElement;
-    class MdaSchemaGroup;
-    class MdaSchemaGroupRef;
-    class MdaSchemaExtension;
-    class MdaSchemaDeclDefRef;
-
-private:
-    class ValidationResult
-    {
-    public:
-        ValidationResult() { LIMITED_METHOD_CONTRACT; ResetResult(); }
-        void ResetResult() { LIMITED_METHOD_CONTRACT; m_bValid = TRUE; m_pViolatedElement = NULL; m_pViolatingElement = NULL; m_pXmlRoot = NULL; m_pSchema = NULL; }
-        BOOL ValidationFailed() { LIMITED_METHOD_CONTRACT; return !m_bValid; }
-        void Initialize(MdaSchema* pSchema, MdaXmlElement* pRoot) { LIMITED_METHOD_CONTRACT; m_pXmlRoot = pRoot; m_pSchema = pSchema; }
-        void SetError() { LIMITED_METHOD_CONTRACT; m_bValid = FALSE; }
-        void SetError(MdaSchemaBase* pViolatedElement, MdaXmlElement* pViolatingElement)
-            { LIMITED_METHOD_CONTRACT; m_bValid = FALSE; m_pViolatedElement = pViolatedElement; m_pViolatingElement = pViolatingElement; }
-
-    private:
-        friend class MdaXmlValidationError;
-        
-    private:
-        BOOL m_bValid;
-        MdaXmlElement* m_pXmlRoot;
-        MdaSchema* m_pSchema;        
-        MdaSchemaBase* m_pViolatedElement;
-        MdaXmlElement* m_pViolatingElement;
-    };
-
-private:
-    static BOOL MayHaveAttr(MdaSchemaBase* pBase) { LIMITED_METHOD_CONTRACT; return MdaSchemaTypeToMetaType[pBase->GetSchemaType()] & MdaSchemaMataMayHaveAttributes; }
-    static BOOL IsPattern(MdaSchemaBase* pBase) { LIMITED_METHOD_CONTRACT; return MdaSchemaTypeToMetaType[pBase->GetSchemaType()] & MdaSchemaMataTypePattern; }
-    static BOOL IsRef(MdaSchemaBase* pBase) { LIMITED_METHOD_CONTRACT; return MdaSchemaTypeToMetaType[pBase->GetSchemaType()] & MdaSchemaMataTypeRef; }
-    static BOOL IsDeclDef(MdaSchemaBase* pBase) { LIMITED_METHOD_CONTRACT; return MdaSchemaTypeToMetaType[pBase->GetSchemaType()] & MdaSchemaMataTypeDeclDef; }
-    static BOOL IsDeclDefRef(MdaSchemaBase* pBase) { WRAPPER_NO_CONTRACT; return IsDeclDef(pBase) || IsRef(pBase); }
-    static MdaSchemaDeclDefRef* AsDeclDefRef(MdaSchemaBase* pBase) { WRAPPER_NO_CONTRACT; if (!IsDeclDefRef(pBase)) return NULL; return (MdaSchemaDeclDefRef*)pBase; }
-    static MdaSchemaDeclDefRef* ToDeclDefRef(MdaSchemaBase* pBase) { WRAPPER_NO_CONTRACT; ASSERT(IsDeclDefRef(pBase)); return (MdaSchemaDeclDefRef*)pBase; }
-    static MdaSchemaDeclDefRef* ToDeclDef(MdaSchemaBase* pBase) { WRAPPER_NO_CONTRACT; ASSERT(IsDeclDef(pBase)); return (MdaSchemaDeclDefRef*)pBase; }
-    static MdaSchemaDeclDefRef* ToRef(MdaSchemaBase* pBase) { WRAPPER_NO_CONTRACT; ASSERT(IsRef(pBase)); return (MdaSchemaDeclDefRef*)pBase; }
-
-public:
-    typedef enum {
-        MdaSchemaSequenceType,
-        MdaSchemaChoiceType,
-        MdaSchemaGroupType,
-        MdaSchemaGroupRefType,
-        MdaSchemaRootType,
-        MdaSchemaAttributeType,
-        MdaSchemaElementType,
-        MdaSchemaComplexTypeType,
-        MdaSchemaComplexTypeDefType,
-        MdaSchemaElementRefTyp,
-        MdaSchemaExtensionType,
-        MdaSchemaElementRefTypeType,
-        MdaSchemaComplexContentType,
-        MdaSchemaElementAnyType,
-        MdaSchemaTypeEnd,
-    } MdaSchemaType;
-
-    typedef enum {
-        MdaSchemaMataNone               = 0x0,
-        MdaSchemaMataTypePattern        = 0x1,
-        MdaSchemaMataTypeDeclDef        = 0x2,
-        MdaSchemaMataTypeRef            = 0x4,        
-        MdaSchemaMataMayHaveAttributes  = 0x8,        
-    } MdaSchemaMetaType;
-    
-private:
-    static MdaElemDeclDef MdaSchemaTypeToElemDef[];
-    static MdaSchemaMetaType MdaSchemaTypeToMetaType[];
-
-    class MdaSchemaBase
-    {
-    public:
-        virtual MdaSchemaType GetSchemaType() = 0;
-        virtual MdaElemDeclDef GetSchemaDeclDef() { LIMITED_METHOD_CONTRACT; return MdaSchemaTypeToElemDef[GetSchemaType()]; }
-        virtual BOOL Validate(MdaXmlElement* pElement, ValidationResult* pResult);
-        virtual BOOL ValidatePattern(MdaXmlElement* pElement, ValidationResult* pResult, COUNT_T* pCount) { UNREACHABLE(); }
-        virtual void SetAttributes(MdaXmlElement* pXml) { LIMITED_METHOD_CONTRACT; }
-        
-    public:
-        void Verify(MdaSchemaType schemaType, MdaElemDeclDef declDef) 
-        { 
-            LIMITED_METHOD_CONTRACT; 
-            // Look for missmatch element in your schema ELEMENT(Foo) ... ELEMENT_END(bar)
-            ASSERT(schemaType == GetSchemaType() && 
-                W("Mismatch element in your schema ELEMENT(foo) ... TYPE_END(foo) -- attach debugger and look for MdaAssistantSchema on stack"));
-            ASSERT(ToDeclDef(this)->GetDeclDef() == declDef && 
-                W("Mismatch declaration in your schema ELEMENT(Foo) ... ELEMENT_END(bar) -- attach debugger and look for MdaAssistantSchema on stack")); 
-        }
-        void Verify(MdaSchemaType schemaType, MdaSchemaBase** ppRef) 
-        { 
-            LIMITED_METHOD_CONTRACT; 
-            // Look for missmatch element in your schema ELEMENT(Foo) ... ELEMENT_END(bar)
-            ASSERT(schemaType == GetSchemaType() && 
-                W("Mismatch element in your schema ELEMENT(foo) ... TYPE_END(foo) -- attach debugger and look for MdaAssistantSchema on stack"));
-            ASSERT(ToRef(this)->m_ppRef == ppRef && 
-                W("Mismatch declaration in your schema ELEMENT(foo) ... ELEMENT_END(bar) -- attach debugger and look for MdaAssistantSchema on stack")); 
-        }
-        void Verify(MdaSchemaType schemaType) 
-        { 
-            LIMITED_METHOD_CONTRACT; 
-            // Look for missmatch element in your schema ELEMENT(Foo) ... ELEMENT_END(bar)
-            ASSERT(schemaType == GetSchemaType() && 
-                W("Mismatch element in your schema ELEMENT(foo) ... TYPE_END(foo) -- attach debugger and look for MdaAssistantSchema on stack")); 
-        }
-        
-    public:
-        MdaXmlElement* ToXml(MdaXmlIndustry* pMdaXmlIndustry, MdaSchemaBase* pViolation = NULL);
-        MdaXmlElement* ToXml(MdaXmlElement* pXmlRoot) { WRAPPER_NO_CONTRACT; return ToXml(pXmlRoot, NULL); }
-        MdaXmlElement* ToXml(MdaXmlElement* pXmlRoot, MdaSchemaBase* pViolation);
-        void AddChild(MdaSchemaBase* pElement);
-        LPCWSTR GetName() { WRAPPER_NO_CONTRACT; return GetElementName(GetSchemaDeclDef()); }
-        friend class MdaSchemaExtension;
-        
-    protected:
-        InlineSArray<MdaSchemaBase*, MDA_XML_ELEMENT_CHILDREN> m_children;
-        virtual InlineSArray<MdaSchemaAttribute*, MDA_XML_ELEMENT_CHILDREN>& GetAttributes() { LIMITED_METHOD_CONTRACT; UNREACHABLE(); }
-    };
-
-    // <xs:schema>
-    class MdaSchemaRoot : public MdaSchemaBase
-    {
-    public:
-        virtual MdaSchemaType GetSchemaType() { LIMITED_METHOD_CONTRACT; return MdaSchemaRootType; }
-        virtual BOOL Validate(MdaXmlElement* pElement, ValidationResult* pResult);
-    };
-
-    // <xs:attribute name="enable" value="xs:boolean" required="true" default="true">
-    static BOOL MdaSchema::Validate(MdaSchemaAttribute* pThis, MdaXmlElement* pElement, ValidationResult* pResult);
-    class MdaSchemaAttribute : public MdaSchemaBase
-    {
-    public:
-        virtual MdaSchemaType GetSchemaType() { LIMITED_METHOD_CONTRACT; return MdaSchemaAttributeType; }
-        virtual BOOL Validate(MdaXmlElement* pElement, ValidationResult* pResult) { WRAPPER_NO_CONTRACT; return MdaSchema::Validate(this, pElement, pResult); }
-        
-    public:
-        void SetAttributes(MdaXmlElement* pXml);
-        MdaSchemaAttribute* Initialize(MdaAttrDeclDef name, MdaSchemaPrimitive type, BOOL bRequired, LPCWSTR szDefault) 
-            { WRAPPER_NO_CONTRACT; m_declDef = name; m_type = type; m_bRequired = bRequired; m_szDefault = szDefault; return this; }
-        
-    private:
-        friend MdaSchema;
-        
-    private:       
-        BOOL m_bRequired; 
-        SString m_szDefault;
-        MdaAttrDeclDef m_declDef;
-        MdaSchemaPrimitive m_type;
-    };
-
-    // <xs:sequence minOccures="0" maxOccures="unbounded">
-    class MdaSchemaSequence : public MdaSchemaBase
-    {
-    public:
-        virtual MdaSchemaType GetSchemaType() { LIMITED_METHOD_CONTRACT; return MdaSchemaSequenceType; }
-        virtual BOOL ValidatePattern(MdaXmlElement* pElement, ValidationResult* pResult, COUNT_T* pCount);
-        virtual void SetAttributes(MdaXmlElement* pXml);
-        
-    public:
-        MdaSchemaSequence* Initialize(COUNT_T min, COUNT_T max) { WRAPPER_NO_CONTRACT; m_min = min; m_max = max; return this; }
-        
-    private:
-        BOOL m_VsHack;
-        COUNT_T m_min;
-        COUNT_T m_max;
-    };
-
-    // <xs:choice>
-    class MdaSchemaChoice : public MdaSchemaBase
-    {
-    public:
-        virtual MdaSchemaType GetSchemaType() { LIMITED_METHOD_CONTRACT; return MdaSchemaChoiceType; }
-        virtual BOOL ValidatePattern(MdaXmlElement* pElement, ValidationResult* pResult, COUNT_T* pCount);
-    };
-    
-    // <xs:complexContent>
-    class MdaSchemaComplexContent : public MdaSchemaBase
-    {
-    public:
-        virtual MdaSchemaType GetSchemaType() { LIMITED_METHOD_CONTRACT; return MdaSchemaComplexContentType; }
-        virtual BOOL Validate(MdaXmlElement* pElement, ValidationResult* pResult);
-    };
-
-    // <xs:complexType>
-    class MdaSchemaComplexType : public MdaSchemaBase
-    {
-    public:
-        virtual MdaSchemaType GetSchemaType() { LIMITED_METHOD_CONTRACT; return MdaSchemaComplexTypeType; }
-        virtual BOOL Validate(MdaXmlElement* pElement, ValidationResult* pResult);
-        virtual InlineSArray<MdaSchemaAttribute*, MDA_XML_ELEMENT_CHILDREN>& GetAttributes() { LIMITED_METHOD_CONTRACT; return m_attributes; }
-
-    private:
-        friend class MdaSchemaExtension;
-        InlineSArray<MdaSchemaAttribute*, MDA_XML_ELEMENT_CHILDREN> m_attributes;
-    };
-
-    class MdaSchemaDeclDefRef : public MdaSchemaBase
-    {
-    public:
-        virtual void SetAttributes(MdaXmlElement* pXml);
-
-    public:
-        MdaSchemaDeclDefRef() : m_declDef(MdaElemUndefined), m_ppRef(NULL) { LIMITED_METHOD_CONTRACT; }
-        LPCWSTR GetDeclDefName() { WRAPPER_NO_CONTRACT; ASSERT(IsDeclDef(this)); return GetElementName(m_declDef); }
-        LPCWSTR GetRefName() { LIMITED_METHOD_CONTRACT; return GetRef()->GetDeclDefName(); }
-        MdaElemDeclDef GetDeclDef() { LIMITED_METHOD_CONTRACT; ASSERT(IsDeclDef(this)); return m_declDef; }
-        MdaSchemaDeclDefRef* GetRef() { LIMITED_METHOD_CONTRACT; ASSERT(IsRef(this)); return ToDeclDef(*m_ppRef); }
-        BOOL IsDefinition() { LIMITED_METHOD_CONTRACT; ASSERT(IsDeclDef(this)); return m_declDef < MdaElemDef(Max); }
-
-    public:
-        MdaSchemaDeclDefRef* InitRef(MdaSchemaBase** ppRef) { WRAPPER_NO_CONTRACT; ASSERT(IsRef(this)); m_ppRef = ppRef; return this; }
-        MdaSchemaDeclDefRef* InitDeclDef(MdaElemDeclDef declDef) { WRAPPER_NO_CONTRACT; ASSERT(IsDeclDef(this)); m_declDef = declDef; return this; }
-
-    private:
-        friend class MdaSchemaBase;
-        MdaSchemaBase** m_ppRef;
-        MdaElemDeclDef m_declDef;
-    };
-
-    // <xs:group name="myGroup">
-    class MdaSchemaGroup : public MdaSchemaDeclDefRef
-    {
-    public:
-        virtual MdaSchemaType GetSchemaType() { LIMITED_METHOD_CONTRACT; return MdaSchemaGroupType; }
-        virtual BOOL ValidatePattern(MdaXmlElement* pElement, ValidationResult* pResult, COUNT_T* pCount);
-    };
-
-    // <xs:element name="myGroup">
-    class MdaSchemaElement : public MdaSchemaDeclDefRef
-    {
-    public:
-        virtual MdaSchemaType GetSchemaType() { LIMITED_METHOD_CONTRACT; return MdaSchemaElementType; }
-        virtual BOOL Validate(MdaXmlElement* pElement, ValidationResult* pResult);
-    };
-
-    // <xs:complexType name="myElementType">
-    class MdaSchemaComplexTypeDef : public MdaSchemaDeclDefRef
-    {
-    public:
-        virtual MdaSchemaType GetSchemaType() { LIMITED_METHOD_CONTRACT; return MdaSchemaComplexTypeDefType; }
-        virtual BOOL Validate(MdaXmlElement* pElement, ValidationResult* pResult);
-        virtual InlineSArray<MdaSchemaAttribute*, MDA_XML_ELEMENT_CHILDREN>& GetAttributes() { LIMITED_METHOD_CONTRACT; return m_attributes; }
-
-    private:
-        friend class MdaSchemaExtension;
-        InlineSArray<MdaSchemaAttribute*, MDA_XML_ELEMENT_CHILDREN> m_attributes;
-    };
-
-    // <xs:group ref="myGroup">
-    class MdaSchemaGroupRef : public MdaSchemaDeclDefRef
-    {
-    public:
-        virtual MdaSchemaType GetSchemaType() { LIMITED_METHOD_CONTRACT; return MdaSchemaGroupRefType; }
-        virtual BOOL ValidatePattern(MdaXmlElement* pElement, ValidationResult* pResult, COUNT_T* pCount);
-    };
-
-    // <xs:extension base="myElementType">
-    class MdaSchemaExtension : public MdaSchemaDeclDefRef
-    {
-    public:
-        virtual MdaSchemaType GetSchemaType() { LIMITED_METHOD_CONTRACT; return MdaSchemaExtensionType; }
-        virtual BOOL Validate(MdaXmlElement* pXml, ValidationResult* pResult);
-        virtual InlineSArray<MdaSchemaAttribute*, MDA_XML_ELEMENT_CHILDREN>& GetAttributes() { LIMITED_METHOD_CONTRACT; return m_attributes; }
-        
-    public:
-        MdaSchemaExtension() { LIMITED_METHOD_CONTRACT; }
-
-    private:
-        InlineSArray<MdaSchemaAttribute*, MDA_XML_ELEMENT_CHILDREN> m_attributes;
-    };
-
-    // <xs:element ref="myElement">
-    class MdaSchemaElementRef : public MdaSchemaDeclDefRef
-    {
-    public:
-        virtual MdaSchemaType GetSchemaType() { LIMITED_METHOD_CONTRACT; return MdaSchemaElementRefTyp; }
-        virtual BOOL Validate(MdaXmlElement* pElement, ValidationResult* pResult);
-    };
-
-    // <xs:element name="myElementAsMyType" type="myType">
-    class MdaSchemaElementRefType : public MdaSchemaDeclDefRef
-    {
-    public:
-        virtual MdaSchemaType GetSchemaType() { LIMITED_METHOD_CONTRACT; return MdaSchemaElementRefTypeType; }
-        virtual BOOL Validate(MdaXmlElement* pElement, ValidationResult* pResult);
-    };
-
-    // <xs:element name="myElementAsMyType" type="xs:anyType">
-    class MdaSchemaElementAny : public MdaSchemaDeclDefRef
-    {
-    public:
-        virtual MdaSchemaType GetSchemaType() { LIMITED_METHOD_CONTRACT; return MdaSchemaElementAnyType; }
-        virtual BOOL Validate(MdaXmlElement* pElement, ValidationResult* pResult);
-    };
-/*
-    // <xs:simpleType name="mySimpleType>
-    class MdaSimpleTypeDef : public MdaSchemaDeclDefRef
-    {
-    }
-
-    // <xs:restriction base="xs:string>
-    class MdaRestriction : public MdaSchemaDeclDefRef
-    {
-    }
-
-    // <xs:enumeration value="blue">
-    class MdaEnumeration : public MdaSchemaBase
-    {
-    }
-*/
-private:
-    MdaSchema();
-    virtual LPCWSTR SetRootAttributes(MdaXmlElement* pXml) = 0;
-    ValidationResult* Validate(MdaXmlElement* pRoot, ValidationResult* pResult);
-    MdaXmlElement* ToXml(MdaXmlElement* pXmlRoot) { WRAPPER_NO_CONTRACT; return m_tos->ToXml(pXmlRoot); }
-    MdaXmlElement* ToXml(MdaXmlIndustry* pMdaXmlIndustry) { WRAPPER_NO_CONTRACT; return m_tos->ToXml(pMdaXmlIndustry); }
-    MdaXmlElement* ToXml(MdaXmlIndustry* pMdaXmlIndustry, MdaSchemaBase* pXsdViolation) { WRAPPER_NO_CONTRACT; return m_tos->ToXml(pMdaXmlIndustry, pXsdViolation); }
-        
-private: // Assistant Definitions
-    void DefineAssistant(MdaElemDeclDef name) { WRAPPER_NO_CONTRACT; m_currentAssistant = name; }  
-    void DefineAssistantEnd(MdaElemDeclDef name) { WRAPPER_NO_CONTRACT; m_currentAssistant = MdaElemUndefined; }      
-    void DefineAssistantInput(MdaElemDeclDef name) { WRAPPER_NO_CONTRACT; ASSERT(m_currentAssistant == name); AddExtendElement(name, MdaElemDef(Assistant)); }  
-    void DefineAssistantInputEnd(MdaElemDeclDef name) { WRAPPER_NO_CONTRACT; ASSERT(m_currentAssistant == name); AddExtendElementEnd(name, MdaElemDef(Assistant)); }      
-    void DefineAssistantOutput(MdaElemDeclDef name, MdaElemDeclDef msgName) { WRAPPER_NO_CONTRACT; ASSERT(m_currentAssistant == name); AddExtendElement(msgName, MdaElemDef(AssistantMsgType)); }  
-    void DefineAssistantOutputEnd(MdaElemDeclDef name, MdaElemDeclDef msgName) { WRAPPER_NO_CONTRACT; ASSERT(m_currentAssistant == name); AddExtendElementEnd(msgName, MdaElemDef(AssistantMsgType)); }      
-    
-private: // <xs:*>    
-    void DefineSchema() { WRAPPER_NO_CONTRACT; m_tos = m_schemaRootFactory.Create(); }    
-    void DefineSchemaEnd() { CONTRACTL {NOTHROW; GC_NOTRIGGER; MODE_ANY; PRECONDITION(m_stack.GetDepth() == 0); } CONTRACTL_END; }
-    void AddElement(MdaElemDeclDef name) { WRAPPER_NO_CONTRACT; Push(CreateDeclDef(name, &m_elementFactory)); Push(m_complexTypeFactory.Create()); }
-    void AddElementRefType(MdaElemDeclDef name, MdaElemDeclDef type) { WRAPPER_NO_CONTRACT; AddTerminal(CreateDeclDef(name, &m_elementRefTypeFactory)->InitRef(GetDef(type))); }
-    void AddElementAny(MdaElemDeclDef name) { WRAPPER_NO_CONTRACT; AddTerminal(CreateDeclDef(name, &m_elementAnyFactory)); }
-    void AddExtendElement(MdaElemDeclDef name, MdaElemDeclDef type) { WRAPPER_NO_CONTRACT; AddElement(name); AddExtension(type); }
-    void AddComplexType(MdaElemDeclDef name) { WRAPPER_NO_CONTRACT; Push(CreateDeclDef(name, &m_complexTypeDefFactory)); }   
-    void AddExtendType(MdaElemDeclDef name, MdaElemDeclDef type) { WRAPPER_NO_CONTRACT; AddComplexType(name); AddExtension(type); }
-    void AddExtension(MdaElemDeclDef type) { WRAPPER_NO_CONTRACT; Push(m_complexContentFactory.Create()); Push(m_extensionFactory.Create()->InitRef(GetDef(type))); }
-    void RefElement(MdaElemDeclDef name) { WRAPPER_NO_CONTRACT; AddTerminal(m_elementRefFactory.Create()->InitRef(GetDef(name))); }
-    void RefGroup(MdaElemDeclDef name) { WRAPPER_NO_CONTRACT; AddTerminal(m_groupRefFactory.Create()->InitRef(GetDef(name))); }
-    void AddChoice() { WRAPPER_NO_CONTRACT; Push(m_choiceFactory.Create()); }
-    void AddGroup(MdaElemDeclDef name) { WRAPPER_NO_CONTRACT; Push(CreateDeclDef(name, &m_groupFactory)); }
-    void AddSequence(COUNT_T minOccures, COUNT_T maxOccures) { WRAPPER_NO_CONTRACT; Push(m_sequenceFactory.Create()->Initialize(minOccures, maxOccures)); }
-    void AddAttribute(MdaAttrDeclDef name, MdaSchemaPrimitive type, BOOL bRequired, LPCWSTR szDefault) 
-        { WRAPPER_NO_CONTRACT; AddTerminal(m_attrFactory.Create()->Initialize(name, type, bRequired, szDefault)); }
-    
-private: // </xs:*>   
-    void AddElementEnd(MdaElemDeclDef name) { WRAPPER_NO_CONTRACT; Pop()->Verify(MdaSchemaComplexTypeType); Pop()->Verify(MdaSchemaElementType, name); }    
-    void AddExtendElementEnd(MdaElemDeclDef name, MdaElemDeclDef type) { WRAPPER_NO_CONTRACT; AddExtensionEnd(type); AddElementEnd(name); }        
-    void AddComplexTypeEnd(MdaElemDeclDef name) { WRAPPER_NO_CONTRACT; Pop()->Verify(MdaSchemaComplexTypeDefType, name); }
-    void AddExtendTypeEnd(MdaElemDeclDef name, MdaElemDeclDef type) { WRAPPER_NO_CONTRACT; AddExtensionEnd(type); AddComplexTypeEnd(name); }   
-    void AddExtensionEnd(MdaElemDeclDef name) { WRAPPER_NO_CONTRACT; Pop()->Verify(MdaSchemaExtensionType, GetDef(name)); Pop()->Verify(MdaSchemaComplexContentType); }        
-    void AddGroupEnd(MdaElemDeclDef name) { WRAPPER_NO_CONTRACT; Pop()->Verify(MdaSchemaGroupType, name); }
-    void AddChoiceEnd() { WRAPPER_NO_CONTRACT; Pop()->Verify(MdaSchemaChoiceType); }
-    void AddSequenceEnd() { WRAPPER_NO_CONTRACT; Pop()->Verify(MdaSchemaSequenceType); }    
-        
-private:
-    MdaSchemaBase* Pop() { WRAPPER_NO_CONTRACT; ASSERT(m_stack.GetDepth() > 0); MdaSchemaBase* popped = m_tos; m_tos = m_stack.Pop(); return popped; } 
-    void AddTerminal(MdaSchemaBase* pSchemaBase) { WRAPPER_NO_CONTRACT; m_tos->AddChild(pSchemaBase); }
-    
-    template<typename TYPE>
-    TYPE* Push(TYPE* pChild)  { WRAPPER_NO_CONTRACT; AddTerminal(pChild); m_stack.Push(m_tos); m_tos = pChild; return pChild; }
-
-    template<typename TYPE>
-    TYPE* CreateDeclDef(MdaElemDeclDef name, MdaFactory<TYPE>* m_pFactory)
-    {
-        WRAPPER_NO_CONTRACT;
-
-        TYPE* pDeclDef = m_pFactory->Create();
-        pDeclDef->InitDeclDef(name);
-
-        if (pDeclDef->IsDefinition())
-        {
-            ASSERT(m_stack.GetDepth() == 0);
-            *GetDef(name) = pDeclDef;
-        }
-
-        return pDeclDef;
-    }
-    
-    MdaSchemaBase** GetDef(MdaElemDeclDef type) { WRAPPER_NO_CONTRACT; return &m_definitions[type]; }
-
-private:
-    friend class ManagedDebuggingAssistants;
-    friend class MdaFramework;
-    friend class MdaXmlElement;
-    friend class MdaXmlAttribute;
-    friend class MdaAssistant;
-    friend class MdaAssistantSchema;
-    friend class MdaAssistantMsgSchema;
-    friend class MdaSchemaSchema;
-    friend class MdaXPath;
-    friend class MdaXmlMessage;
-    friend class MdaXmlValidationError;
-       
-private:
-    MdaFactory<MdaSchemaRoot> m_schemaRootFactory;
-    MdaFactory<MdaSchemaAttribute> m_attrFactory;
-    MdaFactory<MdaSchemaSequence> m_sequenceFactory;
-    MdaFactory<MdaSchemaChoice> m_choiceFactory;
-    MdaFactory<MdaSchemaGroup> m_groupFactory;
-    MdaFactory<MdaSchemaGroupRef> m_groupRefFactory;
-    MdaFactory<MdaSchemaComplexTypeDef> m_complexTypeDefFactory;
-    MdaFactory<MdaSchemaComplexType> m_complexTypeFactory;
-    MdaFactory<MdaSchemaComplexContent> m_complexContentFactory;
-    MdaFactory<MdaSchemaElement> m_elementFactory;
-    MdaFactory<MdaSchemaElementRef> m_elementRefFactory;
-    MdaFactory<MdaSchemaElementRefType> m_elementRefTypeFactory;
-    MdaFactory<MdaSchemaExtension> m_extensionFactory;
-    MdaFactory<MdaSchemaElementAny> m_elementAnyFactory;
-    
-private:
-    MdaSchemaBase* m_definitions[MdaElemEnd];
-    MdaElemDeclDef m_currentAssistant;
-    MdaSchemaBase* m_tos;  
-    MdaStack<MdaSchemaBase*> m_stack;
-};
-
-
-//
-// MdaAssistantMsgSchema 
-//
-class MdaAssistantSchema : public MdaSchema
-{
-private:
-    MdaAssistantSchema();
-    LPCWSTR SetRootAttributes(MdaXmlElement* pXml);
-        
-private:
-    friend class ManagedDebuggingAssistants;
-    friend class MdaXmlElement;
-    friend class MdaAssistant;    
-};
-
-
-//
-// MdaAssistantMsgSchema 
-//
-class MdaAssistantMsgSchema : public MdaSchema
-{
-private:
-    MdaAssistantMsgSchema();
-    LPCWSTR SetRootAttributes(MdaXmlElement* pXml);
-        
-private:
-    friend class ManagedDebuggingAssistants;
-    friend class MdaXmlElement;
-    friend class MdaAssistant;    
-};
-
-
-//
-// MdaSchemaSchema 
-//
-class MdaSchemaSchema : public MdaSchema
-{
-private:
-    MdaSchemaSchema();
-    LPCWSTR SetRootAttributes(MdaXmlElement* pXml);
-    
-private:
-    friend class ManagedDebuggingAssistants;
-    friend class MdaXmlElement;
-    friend class MdaAssistant;    
-};
-
-
-//
-// MdaQuery
-//
-
-BOOL IsJustMyCode(MethodDesc* pMethodDesc);
-
-class MdaQuery
-{
-private:
-    class CompiledQuery
-    {
-    public:
-        CompiledQuery();
-
-    public:
-        BOOL Test(MethodDesc* pMethodDesc);
-        BOOL Test(FieldDesc* pFieldDesc);
-        BOOL Test(MethodTable* pMethodTable);
-        
-    public:
-        void SetName(LPCWSTR name);
-        void SetNestedTypeName(LPCWSTR name);
-        void SetMemberName(LPCWSTR name) { WRAPPER_NO_CONTRACT; m_sszMember.Set(name); }
-        void SetAnyMember();
-        void SetAnyType();
-        void SetJustMyCode() { LIMITED_METHOD_CONTRACT; m_bJustMyCode = TRUE; }
-       
-    private:
-        BOOL Test(SString* psszName, MethodTable* pMethodTable);
-        
-    private:
-        friend class MdaQuery;
-        
-    private:
-        BOOL m_bAnyMember;
-        BOOL m_bAnyType;
-        BOOL m_bJustMyCode;
-        StackSString m_sszFullname;
-        StackSString m_sszMember;
-    };
-
-public:
-    class CompiledQueries
-    {
-    public:
-        CompiledQueries() { LIMITED_METHOD_CONTRACT; }
-
-    public:
-        BOOL Test(MethodDesc* pMethodDesc);
-        BOOL Test(FieldDesc* pFieldDesc);
-        BOOL Test(MethodTable* pMethodTable);
-
-    private:
-        friend class MdaQuery;
-        
-    private:
-        CompiledQuery* AddQuery();
-        
-    private:
-        InlineSArray<CompiledQuery*, 10> m_queries;
-        MdaFactory<CompiledQuery> m_factory;
-    };
-    
-public:
-    static void Compile(MdaXmlElement* pXmlFilter, CompiledQueries* pCompiledQueries);
-    
-private:
-    friend class ManagedDebuggingAssistants;
-    
-private:
-    class Compiler
-    {
-    private:
-        friend class CompiledQuery;
-        friend class MdaQuery;
-        
-    private:
-        BOOL Compile(SString* sszQuery, CompiledQuery* pCompiledQuery);
-
-        typedef enum 
-        {
-            //
-            // TOKENS
-            //
-            MdaFilterIdentifier          = 0x0001,
-            MdaFilterDot                 = 0x0002,
-            MdaFilterPlus                = 0x0004,
-            MdaFilterAstrix              = 0x0008,
-            MdaFilterColon               = 0x0010,
-            MdaFilterEnd                 = 0x4000,
-        } 
-        Token;
-
-    //
-    // LEXIFIER 
-    //
-    private:
-        Token LexAToken();
-        void NextToken()  { WRAPPER_NO_CONTRACT; m_currentToken = LexAToken(); }
-        BOOL TokenIs(Token token) { LIMITED_METHOD_CONTRACT; return !!(m_currentToken & token); }
-        BOOL TokenIs(int token) { LIMITED_METHOD_CONTRACT; return TokenIs((Token)token); }
-        LPCWSTR GetIdentifier() { WRAPPER_NO_CONTRACT; return m_identifier.GetUnicode(); }
-        
-    //
-    // PRODUCTIONS
-    //
-    private: 
-        
-        BOOL NAME(CompiledQuery* pAst);
-        // '*'
-        // id
-        // id '.' NAME
-        // id '+' NESTNAME 
-        // id ':' ':' MEMBERNAME
-        
-        BOOL NESTNAME(CompiledQuery* pAst);
-        // id '+' NESTNAME  
-        // id ':' ':' MEMBERNAME
-        
-        BOOL MEMBERNAME(CompiledQuery* pAst);
-        // '*'
-        // id
-        
-    private:
-        SString::CIterator m_itr;
-        StackSString m_identifier;
-        Token m_currentToken;
-    };    
-};
-
-
-//
-// MdaConfigFactory 
-//
-class MdaConfigFactory : public IXMLNodeFactory 
-{
-private:
-    friend class ManagedDebuggingAssistants;
-    
-private:
-    static MdaXmlElement* ParseXmlStream(MdaXmlIndustry* pXmlIndustry, LPCWSTR szXmlStream);
-
-private:
-    MdaConfigFactory(MdaXmlElement* pXmlRoot, BOOL bDeveloperSettings = FALSE) { WRAPPER_NO_CONTRACT; m_bParse = !bDeveloperSettings; m_pMdaXmlElement = NULL; m_stack.Push(pXmlRoot); }
-
-public:
-    HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject) { WRAPPER_NO_CONTRACT; return S_OK; }
-    ULONG STDMETHODCALLTYPE AddRef() { WRAPPER_NO_CONTRACT; return 0; }
-    ULONG STDMETHODCALLTYPE Release() { WRAPPER_NO_CONTRACT; return 0; }
-    
-public:
-    HRESULT STDMETHODCALLTYPE NotifyEvent( 
-        IXMLNodeSource* pSource,
-        XML_NODEFACTORY_EVENT iEvt);
-
-    HRESULT STDMETHODCALLTYPE BeginChildren( 
-        IXMLNodeSource* pSource,
-        XML_NODE_INFO* pNodeInfo);
-
-    HRESULT STDMETHODCALLTYPE EndChildren( 
-        IXMLNodeSource* pSource,
-        BOOL fEmptyNode,
-        XML_NODE_INFO* pNodeInfo);
-    
-    HRESULT STDMETHODCALLTYPE Error( 
-        IXMLNodeSource* pSource,
-        HRESULT hrErrorCode,
-        USHORT cNumRecs,
-        XML_NODE_INFO** apNodeInfo);
-    
-    HRESULT STDMETHODCALLTYPE CreateNode( 
-        IXMLNodeSource* pSource,
-        PVOID pNodeParent,
-        USHORT cNumRecs,
-        XML_NODE_INFO** apNodeInfo);
-     
-private:
-    BOOL m_bParse;
-    MdaXmlElement* m_pMdaXmlElement;
-    MdaStack<MdaXmlElement*> m_stack;
-};
-
-#pragma warning(pop)
-
-#include "mda.inl"
-
-#endif
-#endif
-
diff --git a/src/vm/mda.inl b/src/vm/mda.inl
deleted file mode 100644 (file)
index 921f9a3..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-template<typename PRODUCT>
-PRODUCT* MdaFactory<PRODUCT>::Create()
-{
-    WRAPPER_NO_CONTRACT;
-
-    if (m_cProduct == MDA_MAX_FACTORY_PRODUCT) 
-        return GetNext()->Create();
-
-    return &m_product[m_cProduct++];
-}
diff --git a/src/vm/mdaBoilerplate.exe.mda.config b/src/vm/mdaBoilerplate.exe.mda.config
deleted file mode 100644 (file)
index 336bef3..0000000
+++ /dev/null
@@ -1,959 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<!--
-************************************************
-    PLEASE KEEP MDAS IN ALPHABETICAL ORDER!
-************************************************
--->
-
-<!-- 
-
-FEEDBACK:
-    Please add yourself to clrmda discussion alias (just paste this link into
-    IE: http://autogroup/JoinGroup.asp?GroupAlias=clrmda). Once you join, 
-    please send out a "Hello World" mail letting us know what problem your 
-    trying to solve with MDAs. We're interested in feedback on activation, 
-    reporting, VS integration, new MDA requests etc. We'll also send out mail 
-    for any breaking changes or new MDAs. 
-
-OVERVIEW:
-    Managed Debugging Assistants (MDAs) are switches shipped in the retail 
-    runtime to help debug managed code. Each MDA and the problem it addresses 
-    is documented below. 
-
-ACTIVATION\REPORTING QUICK START:
-    Decide which MDAs you'd like enabled by reading their documentation below and then
-    set the environment variable COMPLUS_MDA equal to a semi-colen delemited list of
-    the names of the MDAs you want enabled. The list is not case sensitive. So, for
-    instance if you want the memberInfoCacheCreation, gcUnmanagedToManaged and 
-    gcManagedToUnmanaged MDAs enabled
-
-        set complus_mda=mEmBeRInFoCacheCreation;gcUnmanagedToManaged;gcManagedToUnmanaged
-
-    Any managed program run from that command shell will now have these MDAs enabled. If
-    an MDA fires and no debugger is attached then the dialog very much like the dialog you
-    would get if an unhandled exception occurred which will tell you what MDA fired and 
-    give you a chance to attach a debugger so you can get a stack trace indicating where
-    the MDA fired. 
-
-    If you launch under a debugger you'll have to ensure that the debugger won't ignore the MDAs 
-    you enabled. You can force VS to report all MDAs by checking the "Managed Debugging Assistants" 
-    box in the exceptions dialog. VS uses the same dialog exceptions use to report MDA messages. 
-    Cordbg and windbg report all MDAs by default by splashing the message to the console. 
-    
-ACTIVATION\REPORTING SCENARIOS:
-    The MDA activation and reporting featurs support a variety of scenarios. Those scenarios
-    and the supporting features are described below. 
-        
--->
-
-
-<!-- 
-            Constrained Execution Region (CER) MDA
-            - InvalidCERCall
-            - VirtualCERCall
-            - OpenGenericCERCall
-            - IllegalPrepareConstrainedRegion
-
-            These all fire during the analysis of CER call graphs. This analysis 
-            can occur for a number of reasons: 
-
-                Early bound; triggered by jitting or ngen'ing a method containing a 
-                RuntimeHelpers.PrepareConstrainedRegions() call. Call graph is 
-                rooted at the catch/finally/filter/fault blocks belonging to the 
-                exception handler the PCR call is associated with.
-                
-                At instantiation of "critical" objects. Instances derived from 
-                CriticalFinalizerObject prepare a CER rooted at the finalizer method. 
-                Instances derived from SafeHandle or CriticalHandle additionally have 
-                the ReleaseHandle(), Dispose() and IsInvalid property getter methods 
-                prepared as CER roots.
-                
-                Explicitly via RuntimeHelpers.PrepareMethod() or PrepareDelegates() calls 
-                (the CER root method is passed as an argument, indirectly in the case of 
-                PrepareDelegate() and possibly with exact generic instantiation information 
-                for PrepareMethod()). 
-            
-            Note that for the early bound (PCR precipitated) case the jit time semantics 
-            imply the probe will fire some time before the method which contains the CER 
-            root is called (typically just prior to the first call to that method). Since 
-            the entire CER call graph is scanned in one go, probes relating to methods 
-            deep within the CER will be reported at that time as well (putting the report 
-            even further away from the execution). The probes will not fire each time the
-            method is executed (and if the image is ngen'd then they will not fire at runtime at all).
-            
-            Even in the late bound cases a given probe will fire at most once (we remember 
-            which CERs we've prepared already, subsequent prepare operations on the same 
-            graphs are no-ops). Note that CER graphs that are qualified by generic type 
-            parameters (i.e. those CERs whose root method has generic method or class 
-            type variables) are considered to define distinct CERs for each possible 
-            instantiation of that root method. Therefore multiple calls to PrepareMethod() 
-            with such a root method and different instantiations will cause the analysis 
-            to be run multiple times and therefore any probes will fire on each invocation 
-            (provided the instantiation given hasn't been prepared for that method before).
-            This last case (multiple CER preparations from the same root differing only by 
-            generic instantiation) will occur at jit time only for generic instantiations 
-            that contain only non-reference types (we jit a separate copy of the code for 
-            each of those instantiations). We will refuse to jit-time prepare any method 
-            with a generic instantiation containing one or more reference types, since 
-            code for those cases is shared (and thus at jit time we cannot predict which 
-            exact instantiations will be required at runtime). See the description of 
-            the openGenericCERCall probe.
-            
-        -->
-
-<mdaConfig>
-   <assistants>
-
-          <!-- 
-            AsynchronousThreadAbort (weiwenli)                                               
-            
-            DESCRIPTION:
-            Causes the runtime to fire a MDA message when someone attempts to abort another thread.
-            
-            BEHAVIORAL IMPACT:
-            None.
-            
-        -->
-          <asynchronousThreadAbort enable="false" />
-
-
-          <!-- 
-            BindingFailure (t-daveh)
-       
-            DESCRIPTION: 
-            This probe fires when an Assembly fails to load.
-            
-            SCENARIOS:
-            This probe is intended for use in debugging Assembly binding failures.  In addition to general information
-            identifying the failure and Assembly, the binding context the Assembly would have been loaded in is included.
-            See http://blogs.msdn.com/suzcook/archive/2003/05/29/57143.aspx for more information.            
-
-            BEHAVIORAL IMPACT: None. 
-            
-            OUTPUT: An MDA message is output for each Assembly that fails to load.  It includes the failing HRESULT as well
-            as the display name, code base, binding context index, and AppDomain ID that the Assembly would have had.
-        -->
-          <bindingFailure enable="false" />
-
-
-          <!-- 
-            CallbackOnCollectedDelegate (chriseck)   
-            
-            DESCRIPTION: Detects when unmanaged code is trying to call back into the runtime via a delegate which 
-            has been garbage collected. Will store up to listSize number of delegates after the GC has released them.
-            The default listSize is 1000 members.  The minimum is 50 members.  The maximum is 2000.
-            
-            SCENARIOS:     
-                           
-                SYMPTOM:
-                User code AVs when trying to call back into the runtime on a function pointer which was marshaled from 
-                a managed delegate. The failure is non-deterministic; sometimes the call on the function 
-                pointer succeeds and sometimes it fails. 
-                
-                CAUSE:
-                The delegate which from which the function pointer was created and exposed to unmanaged code was collected
-                so when the unmanaged component tries to call on the function pointer it AVs. By enabling this assistant the runtime
-                will not collect "all" of the delegate - instead it leaks just enough of the delegate so that if someone
-                tries to call back on it the MDA will fire. 
-        -->
-          <callbackOnCollectedDelegate listSize="1000" enable="false" />
-
-          <!-- 
-            ContextSwitchDeadlock (chriseck)    
-           
-            DESCRIPTION:
-            Causes the runtime to fire a MDA message when a deadlock is detected during an attempted context transition
-            
-            BEHAVIORAL IMPACT:
-            None.
-            
-            SCENARIOS:
-            
-                SYMPTOM:
-                A native context transition appears to be deadlocked.
-                
-                CAUSE:
-                Most likely cause is a non-pumping STA thread.
-                
-            OUTPUT:
-            An XML message specifying the violation.
-        -->
-          <contextSwitchDeadlock enable="false" />
-
-          <!-- 
-            DangerousThreadingAPI (weiwenli)                                               
-            
-            DESCRIPTION:
-            Causes the runtime to fire a MDA message when someone attempts to call dangerous threading API.
-            
-            BEHAVIORAL IMPACT:
-            None.
-            
-        -->
-          <dangerousThreadingAPI enable="false" />
-
-
-       <!-- 
-            DirtyCastAndCallOnInterface (chriseck)                                               
-
-            DESCRIPTION:
-            A native component makes a call on an IUnknown or IDispatch interface without first QI-ing for the correct interface.
-           
-            BEHAVIORAL IMPACT:
-            None.
-            
-            SCENARIOS:
-            
-                SYMPTOM:
-                AVs or unexpected memory corruption when making a call from native code into the CLR on a CCW.
-                
-                CAUSE:
-                Caller neglected to QI for the correct interface.
-                
-            OUTPUT:
-            An XML message specifying the violation.
-       -->
-       <dirtyCastAndCallOnInterface enable="false" />
-
-          <!-- 
-            DisconnectedContext (chriseck)  
-
-            DESCRIPTION:
-            The CLR attempts to transition into a dead context while trying to service a request concerning a
-            COM object living in that dead context. This can happen while cleaning up RCWs or servicing QIs.
-            
-            BEHAVIORAL IMPACT:
-            None.
-            
-            SCENARIOS:
-            
-                SYMPTOM:
-                Calls on RCWs living in dead contexts are not serviced, or cleanup of COM interface pointers occurs in 
-                a context other than the one in which the interface pointers live.
-                
-                CAUSE:
-                The OLE context is disconnected.
-                
-            OUTPUT:
-            An XML message specifying the violation.
-        -->
-          <disconnectedContext enable="false" />
-
-
-          <!-- 
-            DllMainReturnsFalse (slidin)                                               
-            ACTIVATION: 
-            Activated by default under a managed debugger.
-       -->
-          <dllMainReturnsFalse enable="false" />
-
-          <!-- 
-            ExceptionSwallowedOnCallFromCom (dmortens)                                               
-            
-            DESCRIPTION:
-            Causes the runtime to fire a MDA message when an error occurs while determining how to marshal the parameters 
-            of a member member to be called from COM. 
-            
-            BEHAVIORAL IMPACT:
-            None.
-            
-            SCENARIOS:
-            
-                SYMPTOM:
-                A failure HRESULT is returned to COM without the managed method having been called.
-                
-                CAUSE:
-                This is most likely due to an incompatible MarshalAs attribute on one of the parameters.
-                
-            OUTPUT:
-            An XML message specifying the violation.
-        -->
-          <exceptionSwallowedOnCallFromCom enable="false" />
-
-
-          <!-- 
-            FailedQI (chriseck)   
-           
-            DESCRIPTION:
-            Causes the runtime to fire a MDA message when the runtime calls QueryInterface on a COM interface pointer
-            on behalf of a RCW, and the QueryInterface call fails because the call was attempted in the wrong context or
-            because an OLE owned proxy returned a failure HRESULT.
-            
-            BEHAVIORAL IMPACT:
-            None.
-            
-            SCENARIOS:
-            
-                SYMPTOM:
-                A cast on a RCW fails, or a call to COM from a RCW fails unexpectedly.
-                
-                CAUSE:
-                Calling from the wrong context or the registered proxy is failing the QueryInterface call.
-                
-            OUTPUT:
-            An XML message specifying the violation.
-        -->
-          <failedQI enable="false" />
-
-
-          <!-- 
-            GcManagedToUnmanaged (chrisk)     
-            
-            DESCRIPTION: Causes a garbage collection whenever a thread transitions from managed to unmanaged 
-            code (also see gcUnmanagedToManaged). 
-                
-            SCENARIOS:     
-                       
-                SYMPTOM: An unmanaged user component AVs when trying to use a managed object which had been exposed to 
-                COM. The COM object appears to have been released. The AV is non-deterministic.
-                            
-                CAUSE: If an unmanaged component is not ref counting a managed COM object correctly
-                then the runtime could collect a managed object exposed to COM when the unmanaged component still
-                holds a reference to the object. The runtime calls release during GCs so if the user component uses the 
-                object before the GC than it will not yet have been collected which is the source of the non-determinism.
-                Enabling this assistant will reduce the time between when the object is eligible for collection and release 
-                is called helping to track down which unmanaged component first tries to access the collected object.
-                       
-            OUTPUT: None         
-        -->
-          <gcManagedToUnmanaged enable="false" />
-
-          <!-- 
-            GcUnmanagedToManaged (chrisk) 
-            
-            DESCRIPTION: 
-            Causes a garbage collection whenever a thread transitions from unmanaged to 
-            managed code (also see gcManagedToUnmanaged).
-            
-            BEHAVIORAL IMPACT: 
-            This assistant changes the behavior of the runtime. When enabled more GC will occur.
-               
-            SCENARIOS: 
-            
-                SYMPTOM: 
-                An application running unmanaged user components (COM\PInvoke) is showing a non-deterministic AV 
-                in runtime code. 
-                            
-                CAUSE: 
-                If an application is running unmanaged user components then those components may have corrupted 
-                the GC heap. This will cause the runtime to AV when the GC tries to walk the object graph. 
-                Enabling this assistant will reduce the time between when the unmanaged component corrupts the GC 
-                heap and when the AV happens by forcing a GC to occur before every managed transition. 
-                             
-            OUTPUT: None   
-        -->
-
-          <gcUnmanagedToManaged enable="false" />
-
-
-          <!-- 
-            IllegalPrepareConstrainedRegion (rudim)    
-
-            This is an error event. The RuntimeHelpers.PrepareConstrainedRegions() method (PCR) 
-            call we use to mark exception handlers as introducing CERs in their catch/finally/fault/filter
-            blocks are only valid when used in that context. They must immediately precede the try 
-            statement of the exception handler. (This is at the IL level, so it's obviously permissible 
-            to have non-code generating source in between the two, such as comments). In the future 
-            these markers will be generated by a compiler (from a new, higher level syntax for marking 
-            CERs) and the code author won't have to worry about this. But until then we help the author 
-            out by generating this MDA when the PCR call appears anywhere else in the code:
-
-            If this MDA is firing the sort of symptoms you'd expect are probably as if CERs had 
-            stopped working (i.e. runtime errors from jitting, thread aborts or generics lazy type 
-            loading occurring inside CER regions). This is because they probably intended to declare 
-            a CER region but failed by mispositioning the PCR call.                      
-        -->
-          <illegalPrepareConstrainedRegion enable="false" />
-
-          <!-- 
-            InvalidApartmentStateChange (chriseck)                                               
-            
-            DESCRIPTION:
-            Causes the runtime to fire a MDA message when someone attempts to change the COM apartment state of a thread which
-            has already been COM initialized to a different apartment state.
-            
-            BEHAVIORAL IMPACT:
-            None.
-            
-            SCENARIOS:
-            
-                SYMPTOM:
-                A thread's COM apartment state is not what was requested.
-                
-                CAUSE:
-                The thread was previously initialized to a different COM apartment state.
-                
-            OUTPUT:
-            An XML message specifying the violation.
-        -->
-          <invalidApartmentStateChange enable="false" />
-
-          <!-- 
-            InvalidCERCall (rudim)      
-
-            This is an error report. It occurs whenever a location within the CER graph 
-            calls a method which has no reliability contract or an excessively weak contract. 
-            A weak contract is one which declares that the worst case state corruption is of 
-            greater scope than the instance passed to the call (i.e. the appdomain or process 
-            state may become corrupted) or that its result is not always deterministically 
-            computable when called within a CER. Either of these states indicates that the 
-            code called may thwart the efforts of the rest of the CER to maintain consistent 
-            state (CERs allow an author to treat errors in a very deterministic manner as a 
-            way on maintaining whatever internal invariants are important to the particular 
-            application and thus allow it to continue running in the face of transient errors 
-            such as out of memory).
-
-            In terms of reliability contract syntax a weak contract is one that does not specify 
-            a Consistency enumeration or specifies ones one of Consistency.MayCorruptProcess or 
-            Consistency.MayCorruptAppDomain or that does not specify a CER enumeration or specifies CER.None.
-
-            When this probe fires there's a chance that the method being called in the CER 
-            can fail in a way that the caller didn't expect or that leaves the appdomain or 
-            process state corrupted or non-recoverable. Of course the called code may actually 
-            work perfectly and the author merely hasn't gotten round to adding a contract. But 
-            the issues involved in hardening code in this way are subtle and most "random" 
-            code doesn't fall out this way. The contracts serve as markers that the author 
-            has done their homework and hardened their algorithms and also as promises that 
-            these guarantees will never backslide in future revisions of the code. (I.e. 
-            they're declarations of intent rather than mere indicators of implementation).
-
-            Because any method with a weak or non-existent contract may potentially fail in 
-            all sorts of unpredictable manners anyway, the runtime doesn't attempt to remove 
-            any of its own unpredictable failures from the method (introduced by lazy jitting 
-            or generics dictionary population or thread aborts for instance). That is, when 
-            this MDA fires it indicates that the runtime didn't include the called method in 
-            the CER being defined; the call graph was pruned at this node (to carry on preparing 
-            this sub-tree would just serve to help mask the potential error).
-
-            So the symptoms this MDA may indicate are unfortunately very broad. They could see 
-            an unexpected OutOfMemory or ThreadAbort exception (among others, we don't guarantee 
-            the list) at the callsite into the "bad" method because the runtime didn't prepare 
-            it ahead of time or protect it from ThreadAbort exceptions at runtime. But worse than 
-            that, any exception that comes from this method at runtime could be leaving the 
-            appdomain or process in a bad state, which is presumably counter to the wishes of 
-            the CER author, since the only reason to declare a CER is to avoid large scale state 
-            corruptions such as these in the first place. How corrupt state manifests itself is 
-            very application specific (since the definition of consistent state belongs to the 
-            application).            
-        -->
-          <invalidCERCall enable="false" />
-
-          <!-- 
-            InvalidFunctionPointerInDelegate (chriseck)                                               
-
-            DESCRIPTION:
-            An invalid function pointer is passed in to construct a delegate over a native function pointer.                                                
-           
-            BEHAVIORAL IMPACT:
-            None.
-            
-            SCENARIOS:
-            
-                SYMPTOM:
-                AVs or unexpected memory corruption when using a delegate over a function pointer.
-                
-                CAUSE:
-                An invalid function pointer was specified.
-                
-            OUTPUT:
-            An XML message specifying the violation.
-        -->
-          <invalidFunctionPointerInDelegate enable="false" />
-
-
-          <!-- 
-            InvalidIUnknown (chriseck)     
-
-            DESCRIPTION:
-            An invalid IUnknown* is passed to managed code from native code. The IUnknown fails to return success 
-            when queried for the IUnknown interface.                                                      
-           
-            BEHAVIORAL IMPACT:
-            None.
-            
-            SCENARIOS:
-            
-                SYMPTOM:
-                Unexpected error when marshaling a COM interface pointer during argument marshaling.
-                
-                CAUSE:
-                A misbehaving QueryInterface implemenation on the COM interface passed to the runtime.
-                
-            OUTPUT:
-            An XML message specifying the violation.
-        -->
-          <invalidIUnknown enable="false" />
-
-          <!-- 
-            InvalidMemberDeclaration (dmortens)                                               
-            
-            DESCRIPTION:
-            Causes the runtime to fire a MDA message when an error occurs while determining how to marshal the parameters 
-            of a member member to be called from COM. 
-            
-            BEHAVIORAL IMPACT:
-            None.
-            
-            SCENARIOS:
-            
-                SYMPTOM:
-                A failure HRESULT is returned to COM without the managed method having been called.
-                
-                CAUSE:
-                This is most likely due to an incompatible MarshalAs attribute on one of the parameters.
-                
-            OUTPUT:
-            An XML message specifying the violation.
-        -->
-          <invalidMemberDeclaration enable="false" />
-
-          <!-- 
-            InvalidOverlappedToPinvoke (mstanton) 
-            
-            DESCRIPTION:
-            This probe fires when an overlapped pointer not created on the gc heap is passed to a popular
-            Win32 function. The potential for heap corruption is high when this is done because the
-            AppDomain where the call is made may unload. In that case, the user code will either free
-            the memory for the overlapped pointer, causing corruption when the operation finishes, or
-            the code will leak the memory, causing difficulties later.
-                
-            Here are the functions that this MDA tracks:
-
-            Module         Function
-            HttpApi.dll    HttpReceiveHttpRequest
-            IpHlpApi.dll   NotifyAddrChange
-            IpHlpApi.dll   NotifyRouteChange
-            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 way to fix this problem is to use a System.Threading.Overlapped object, calling
-            Overlapped.Pack() to get a NativeOverlapped structure that can be passed to the
-            function. If the AppDomain unloads, the CLR will wait until the async operation completes
-            before freeing the pointer.
-
-            Note that this MDA is by default only fires if the P/Invoke is defined in your 
-            code, using your debugger to report the JustMyCode status of each method.
-            A debugger that doesn't understand JustMyCode (such as mdbg with no extensions)
-            will not let this MDA fire.  You can activate this MDA using a config file
-            if you explicitly set justMyCode="false" in your .mda.config file.
-
-            OUTPUT:
-            An XML message specifying the overlapped pointer address, the module name, and the win32
-            function that was called.
-        -->
-          <invalidOverlappedToPinvoke enable="false" justMyCode="true"/>
-
-
-          <!-- 
-            InvalidVariant (chriseck)    
-           
-            DESCRIPTION:
-            Causes the runtime to fire a MDA message when an invalid VARIANT structure is encountered.
-            
-            BEHAVIORAL IMPACT:
-            None.
-            
-            SCENARIOS:
-            
-                SYMPTOM:
-                Unexpected behavior during a transition between native and managed code involving the marshaling
-                of an object to a VARIANT or vice versa.
-                
-                CAUSE:
-                The native code is passing a malformed VARIANT structure to the runtime.
-                
-            OUTPUT:
-            An XML message specifying the violation.
-        -->
-          <invalidVariant enable="false" />
-
-
-          <!-- 
-            JitCompilationStart (chrisk)                        
-             
-            DESCRIPTION:
-            Enabling this assistant causes a message to be generated whenever a method which matches the filter is jitted.
-            This assistant was primarily used to test the MDA framework but could also be used. 
-            
-            BEHAVIORAL IMPACT:
-            None. The performance difference should also be negligible as this assistant is only fired when the method is
-            first jitted. 
-            
-            SCENARIOS:
-            
-                SYMPTOM:
-                clrjit.dll is loaded in a performance scenario in which all assemblies are ngened.
-                
-                CAUSE:
-                This would likely be a bug in the runtime. Enabling this assistant will help determine which method is
-                being jitted.
-                
-            OUTPUT:
-            Methods which match the filter that are being jitted. 
-        -->
-          <jitCompilationStart enable="false">
-                  <methods justMyCode="true">
-                          <match break="false" name="MyMethod" />
-                  </methods>
-          </jitCompilationStart >
-
-          <!-- 
-            LoaderLock (cbrumme)                                               
-           
-           DESCRIPTION:
-           It is unsafe to execute managed code on a thread that holds the operating system's LoaderLock.
-           Violating this rule can lead to deadlocks or calls into DLLs that have not yet been initialized.
-           Such failures are somewhat random and can appear or disappear from run to run of a process.
-           On some platforms, we can detect whether the current thread holds the LoaderLock during a
-           transition from native to managed code.
-           
-           BEHAVIORAL IMPACT:
-           The extra checks can cause a slight slowdown on calls from native code to managed code.  This
-           slowdown is on the order of 10 instructions.
-
-        -->
-          <loaderLock enable="false" />
-
-
-          <!-- 
-            LoadFromContext (t-daveh)
-       
-            DESCRIPTION: 
-            This probe fires when an Assembly loads in the LoadFrom binding context.  This happens on some but not all calls
-            to Assembly.LoadFrom and can also occur when loading dependencies for a separate Assembly loading call.
-            
-            SCENARIOS:
-            This probe is primarily intended for use in debugging Assembly binding failures, which often occur because a call
-            to Assembly.LoadFrom does not imply that the Assembly will be loaded in the LoadFrom context.  Binding contexts
-            affect Assembly behavior, and in almost all cases it is recommended that the LoadFrom context be avoided.  See               
-            http://blogs.msdn.com/suzcook/archive/2003/05/29/57143.aspx for more information.
-            
-            BEHAVIORAL IMPACT: None. 
-            
-            OUTPUT: An MDA message is output for each Assembly loaded in the LoadFrom context.  It includes the display name
-            of the Assembly and its code base.
-        -->
-          <loadFromContext enable="false" />
-
-
-          <!-- 
-            MarshalCleanupError (chriseck)                                               
-
-            DESCRIPTION:
-            The CLR encounters an error while attempting to clean up temporary structures and memory required for marshaling data types between
-            native / managed code boundaries.  It is likely that a memory leak will occur.
-           
-            BEHAVIORAL IMPACT:
-            None.
-            
-            SCENARIOS:
-            
-                SYMPTOM:
-                Memory leak occurs when making native / managed code transitions, runtime state such as thread culture is not restored, or errors occur
-                in SafeHandle cleanup.
-                
-                CAUSE:
-                An unexpected error occurred while cleaning up temporary structures.  Review all SafeHandle destructor / finalizer implementations and 
-                custom-marshaler implementations for errors.
-                
-            OUTPUT:
-            An XML message specifying the encountered problem.
-        -->
-          <marshalCleanupError enable="false" />
-
-          <!-- 
-            Reflection (chrisk)                        
-             
-            DESCRIPTION: 
-            This probe fires when reflection creates a MemberInfo cache. This happens on calls to 
-            Type.GetMethod, Type.GetProperty, Type.GetField etc. Creation of this cache is expensive in working set
-            because it pages in metadata which is usually stored in a cold section of the PE file and because
-            reflection eagerly caches MemberInfos. The Reflection team has plans in Beta2 to make the cache lazy.
-            
-            SCENARIOS:
-            This probe is primarily intended for use in a regression test which ensures that "heavy" reflection is 
-            not used is an optimized scenario. 
-            
-            BEHAVIORAL IMPACT: None. 
-            
-            OUTPUT: A MDA message is output for each time a MemberInfoCache is created. 
-        -->
-          <memberInfoCacheCreation  enable="false"/>
-
-          <!-- 
-            ModuloObjectHashcode (chrisk)
-             
-            DESCRIPTION:
-            Enabling this assistant causes Object.GetHashcode to return the modulus of the hashcode it would
-            have otherwise returned. This does not affect any other implementation of GetHashcode.
-            
-            BEHAVIORAL IMPACT:
-            See Description.
-            
-            SCENARIOS:
-            
-                SYMPTOM:
-                Varied. Generally, after debugging, it is discovered that an object with the wrong identity
-                is being manipulated.
-                
-                CAUSE:
-                Program is using an objects hashcode to identify the object. While it is true that if two 
-                object references are the same their hashcodes are the same, the converse is not true. If two
-                object references have the same hashcodes that does not imply they refer to the same object. 
-                Making this assumption will cause incorrect program behavior in the very rare case when it is false.
-                Enabling this assistant will make it much more likely to have "hashcode collisions" and flesh out bugs.
-                
-            OUTPUT: None
-        -->
-          <moduloObjectHashcode modulus="1" enable="false" />
-
-        <!-- 
-            NonComVisibleBaseClass (dmortens)
-
-            This error event is fired when a QueryInterface call is made on a CCW requesting the class 
-            interface or the default IDispatch, not implemented by an explicit interface, of a COM visible 
-            managed class that derives from a non COM visible base class.        
-
-            The symptoms the user will see is the QueryInterface call failing with a 
-            COR_E_INVALIDOPERATION HRESULT.            
-        -->
-        <nonComVisibleBaseClass enable="false" />
-
-
-          <!-- 
-            NotMarshalable (chriseck)  
-
-            DESCRIPTION:
-            The CLR encounters a COM interface pointer with no valid proxy/stub registered or a misbehaving IMarshalable implementation while attempting
-            to marshal the interface across contexts.
-           
-            BEHAVIORAL IMPACT:
-            None.
-            
-            SCENARIOS:
-            
-                SYMPTOM:
-                Calls are not serviced, or calls occur in the wrong context for COM interface pointers.
-                
-                CAUSE:
-                The CLR encounters a COM interface pointer with no valid proxy/stub registered or a misbehaving IMarshalable implementation.
-                
-            OUTPUT:
-            An XML message specifying the violation.
-        -->
-          <notMarshalable enable="false" />
-
-          <!-- 
-            OpenGenericCERCall (rudim)     
-
-            This event is a warning. It is generated when a CER graph with generic type 
-            variables at the root method is being processed at jit/ngen time and at least 
-            one of the generic type variables is an object reference type. Since at jit time 
-            an instantiation containing an object reference type is only representative (the 
-            resultant code is shared such that each of the object reference type variables may 
-            in fact be any object reference type) we cannot guarantee prepare all runtime 
-            resources ahead of time. In particular methods with generic type variables sometimes 
-            lazily allocate resources behind the user's back (these are referred to as generic 
-            dictionary entries). For instance the statement "List<T> list = new List<T>();" where 
-            T is a generic type variable will need to lookup and possibly create the exact 
-            instantiation (e.g. List<Object>, List<String> etc.) at runtime and this might 
-            fail for a variety of reasons beyond the author's control (out of memory, for instance).
-
-            This probe shouldn't fire for any of the non-jit cases (they always provide an 
-            exact instantiation to work with).
-
-            When this probe fires the likely symptoms you might see are that CERs will appear not 
-            to work at all for the bad instantiations (in fact we don't even attempt to implement 
-            a CER in the circumstances where the event fires). So if the author uses a shared 
-            instantiation of the CER they will not avoid runtime injected jit or generics type 
-            loading errors or thread aborts within the region of the supposed CER.                     
-        -->
-          <openGenericCERCall enable="false" />
-
-          <!-- 
-            OverlappedFreeError (mstanton) 
-            
-            DESCRIPTION:
-            This probe fires if code calls System.Threading.Overlapped.Free(NativeOverlapped *) before
-            the overlapped operation has completed. The overlapped operation needs to be cancelled
-            before this.
-
-            OUTPUT:
-            An XML message specifying the overlapped pointer address that was freed pre-maturely.
-        -->
-          <overlappedFreeError enable="false" />
-
-          <!-- 
-            PInvokeLog (chrisk) 
-            
-            DESCRIPTION:
-            Logs a message the first time a PInvoke call is call is made.    
-                
-            OUTPUT:
-            An XML message specifying the managed PInvoke signature and target which was called for the first time.
-        -->
-          <pInvokeLog enable="false" />
-
-          <!-- 
-            PInvokeStackImbalance (chrisk) 
-            
-            DESCRIPTION:
-            Causes the runtime to compare the actual stack depth before and after a PInvoke call against 
-            what the call depth should be given the calling conventions specified in the DllImport attribute
-            and the arguments. If the depths do not agree than the MDA will fire. (Future versions of this
-            assistant will also check the stack depth of "reverse-PInvoke" or calling back into managed code via
-            a function pointer representing a managed delegate.)
-            
-            BEHAVIORAL IMPACT:
-            This assistants disables PInvoke marshaling optimizations and so PInvoke calls will be slower.
-
-            ACTIVATION: 
-            Activated by default under a managed debugger.
-            
-            SCENARIOS:
-            
-                SYMPTOM:
-                An application AVs when placing or just after placing a PInvoke call. 
-                
-                CAUSE:
-                Very likely that the managed signature, the DllImportAttribute, does not match the unmanaged
-                signature. Either the number or size of the parameters does not match or the calling convention
-                does not match. Try explicitly specifying the calling convention on both the managed and unmanaged
-                sides. It is also possible, though much less likely, that the unmanaged function unbalanced the 
-                stack for some other reason such as a bug in the unmanaged compiler. 
-                
-            OUTPUT:
-            An XML message specifying the managed PInvoke signature which detected the unbalanced stack.
-        -->
-          <pInvokeStackImbalance enable="false" />
-
-          <!-- 
-            RaceOnRCWCleanup (chriseck)    
-           
-            DESCRIPTION:
-            Causes the runtime to fire a MDA message when it detects that a RCW is in use while the user attempts 
-            to free it via Marshal.ReleaseComObject or other such construct.
-            
-            BEHAVIORAL IMPACT:
-            None.
-            
-            SCENARIOS:
-            
-                SYMPTOM:
-                AVs or memory corruption during or after freeing a RCW via Marshal.ReleaseComObject or other such construct.
-                
-                CAUSE:
-                The RCW is in use on another thread or further up the freeing thread stack.  It is illegal to free
-                a RCW that is in use.
-                
-            OUTPUT:
-            An XML message specifying the violation.
-        -->
-          <raceOnRCWCleanup enable="false" />
-
-          <!-- 
-            Reentrancy (cbrumme)                                               
-           
-           DESCRIPTION:
-           Threads that switch between native and managed code in either direction must perform an
-           orderly transition.  However, certain low level extensibility points in the operating system
-           (like the Vectored Exception Handler) allow switches from managed to native code without
-           performing an orderly transition.  Any native code that executes inside these extensibility points
-           must avoid calling back into managed code.  If this rule is violated, the object heap can become
-           corrupted and other serious errors can occur.  This assistant can detect attempts to transition
-           from native to managed code in cases where a prior switch from managed to native code was
-           not performed through an orderly transition.  
-           
-           BEHAVIORAL IMPACT:
-           The extra checks can cause a slight slowdown on calls from native code to managed code.  This
-           slowdown is on the order of 5 instructions.
-
-        -->
-          <reentrancy enable="false" />
-
-
-          <!-- 
-            ReleaseHandleFailed (rudim)       
-
-            This is an error event. It fired when the ReleaseHandle method of a SafeHandle or 
-            CriticalHandle subclass returns false. These methods are provided by the author subclassing 
-            SafeHandle or CriticalHandle so the circumstances are handle specific, but the contract 
-            is the following:
-            
-                Safe and critical handles represent wrappers around vital process resources that 
-                cannot be permitted to leak (otherwise the process will become unusable over time).
-            
-            Therefore the ReleaseHandle method must not fail to perform its function 
-            (once we've acquired such a resource, ReleaseHandle is the only means we have 
-            of releasing it, so failure implies resource leakage).
-            
-            Therefore any failure which does occur during ReleaseHandle (and impedes the 
-            release of the resource) is a serious bug on the part of the author of the ReleaseHandle 
-            method itself (it is their responsibility to make sure the contract is fulfilled, even 
-            if they're calling other people's code to achieve the end effect).
-
-            To aid in debugging such leaks we allow ReleaseHandle to return a boolean result and 
-            if that result is false we generate this MDA with some state information that might 
-            help track down the problem. (We used to throw an IOException in earlier builds of Whidbey). 
-
-            The symptoms the user might see in situations where this MDA fires is resource 
-            leakage (for whatever resource the safe or critical handle is a wrapper for or at 
-            least handles against that resource which can be scarce in their own rite).            
-        -->
-        <releaseHandleFailed enable="false" />
-
-
-          <!-- 
-            ReportAvOnComRelease (chriseck)     
-            
-            DESCRIPTION:
-            Occasionally an exception is thrown due to user refcount errors while performing COM Interop and 
-            using Marshal.Release or Marshal.ReleaseComObject mixed with raw COM calls. Today, this exception 
-            is simply discarded, since not doing so would cause an AV in the runtime and bring it down. Using 
-            this assistant, such exceptions can be detected and reported instead of simply discarded. 
-
-            Two modes are available " if AllowAV is true, then the assistant simply strips the exception handling 
-            from the function. If it is false (by default), then the exception handling occurs, but a warning 
-            message is reported to the user to indicate that an exception was handled.                                                                  
-        -->
-          <reportAvOnComRelease allowAv="false" enable="false" />
-
-        <!-- 
-            VirtualCERCall (rudim)                       
-
-            This is just a warning. It indicates that a callsite within a CER call graph 
-            refers to a virtual target (i.e. a virtual call to a non-final virtual method 
-            or a call via an interface). The runtime cannot predict the destination method 
-            of these calls from IL and metadata analysis alone (which is all we have), so
-            we won't descend into that call tree and prepare it as part of the CER graph (or 
-            automatically block thread aborts in that subtree either). So this warns of cases 
-            where a CER might need to be extended manually via explicit calls to PrepareMethod() 
-            (once the additional information required to compute the call target is known at 
-            runtime).
-
-            Symptoms of a problem reported via this probe are pretty much the same as above. The 
-            callsite can experience a failure from the runtime if the target wasn't explicitly 
-            prepared by another means (e.g. PrepareMethod) and it's not defined whether or not 
-            the code to be run meets any reliability contracts since the runtime couldn't scan 
-            ahead to tell. If the eventual target wasn't hardened for deterministic operation 
-            then it could surprise the author of the CER as above.
-
-        -->
-          <virtualCERCall enable="false" />
-        
-   </assistants>
-</mdaConfig>
-
-
-
diff --git a/src/vm/mdaassistants.cpp b/src/vm/mdaassistants.cpp
deleted file mode 100644 (file)
index c3e1375..0000000
+++ /dev/null
@@ -1,1810 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-
-#include "common.h"
-#ifdef MDA_SUPPORTED
-#include "mda.h"
-#include "mdaassistants.h"
-#include "field.h"
-#include "dllimport.h"
-#ifdef FEATURE_COMINTEROP
-#include "runtimecallablewrapper.h"
-#include "comcallablewrapper.h"
-#include "comcache.h"
-#include "comtoclrcall.h"
-#include "mlinfo.h"
-#endif
-#include "sigformat.h"
-#include "fieldmarshaler.h"
-#include "dllimportcallback.h"
-#include "dbginterface.h"
-#include "finalizerthread.h"
-
-#ifdef FEATURE_COMINTEROP_APARTMENT_SUPPORT
-#include "olecontexthelpers.h"
-#endif // FEATURE_COMINTEROP_APARTMENT_SUPPORT
-
-#ifdef MDA_SUPPORTED
-////
-//// Mda Assistants
-////
-
-
-//
-// MdaFramework
-// 
-void MdaFramework::DumpDiagnostics()
-{
-    CONTRACTL
-    {
-        THROWS;
-        GC_TRIGGERS;
-        MODE_ANY;
-    }
-    CONTRACTL_END;
-    
-    ManagedDebuggingAssistants* pMda = g_mdaStaticHeap.m_pMda;
-
-#ifdef _DEBUG
-    if (m_dumpSchemaSchema)
-    {
-        MdaXmlElement* pXmlSchemaSchema = pMda->m_pSchemaSchema->ToXml(pMda->m_pMdaXmlIndustry);
-//        MdaXmlMessage::SendMessage(pXmlSchemaSchema, TRUE, pMda->m_pSchemaSchema);   
-    }
-
-    if (m_dumpAssistantSchema)
-    {
-        MdaXmlElement* pXmlAssistantMsgSchema = pMda->m_pAssistantMsgSchema->ToXml(pMda->m_pMdaXmlIndustry);
-//        MdaXmlMessage::SendMessage(pXmlAssistantMsgSchema, TRUE, pMda->m_pSchemaSchema);   
-    }
-
-    if (m_dumpAssistantMsgSchema)
-    {
-        MdaXmlElement* pXmlAssistantSchema = pMda->m_pAssistantSchema->ToXml(pMda->m_pMdaXmlIndustry);
-//        MdaXmlMessage::SendMessage(pXmlAssistantSchema, TRUE, pMda->m_pSchemaSchema);   
-    }
-#endif
-}
-
-#ifdef _DEBUG
-extern BOOL g_bMdaDisableAsserts;
-#endif
-
-void MdaFramework::Initialize(MdaXmlElement* pXmlInput)
-{
-    CONTRACTL
-    {
-        THROWS;
-        GC_TRIGGERS;
-        MODE_ANY;
-    }
-    CONTRACTL_END;
-
-#ifdef _DEBUG
-    ManagedDebuggingAssistants* pMda = g_mdaStaticHeap.m_pMda;
-    g_bMdaDisableAsserts = pXmlInput->GetAttributeValueAsBool(MdaAttrDecl(DisableAsserts));
-    MdaXmlElement* pXmlDiagnostics = pXmlInput->GetChild(MdaElemDecl(Diagnostics));
-            
-    if (pXmlDiagnostics)
-    {
-        m_dumpSchemaSchema = pXmlDiagnostics->GetAttributeValueAsBool(MdaAttrDecl(DumpSchemaSchema), FALSE);
-        m_dumpAssistantSchema = pXmlDiagnostics->GetAttributeValueAsBool(MdaAttrDecl(DumpAssistantSchema), FALSE);
-        m_dumpAssistantMsgSchema = pXmlDiagnostics->GetAttributeValueAsBool(MdaAttrDecl(DumpAssistantMsgSchema), FALSE);
-    }
-#endif
-}
-
-//
-// MdaGcUnmanagedToManaged
-//
-void MdaGcUnmanagedToManaged::TriggerGC()
-{
-    WRAPPER_NO_CONTRACT;
-
-    TriggerGCForMDAInternal();
-}
-
-
-//
-// MdaGcManagedToUnmanaged
-//
-void MdaGcManagedToUnmanaged::TriggerGC()
-{
-    WRAPPER_NO_CONTRACT;
-
-    TriggerGCForMDAInternal();
-}
-
-void TriggerGCForMDAInternal()
-{
-    CONTRACTL
-    {
-        NOTHROW;
-        GC_TRIGGERS;
-        MODE_COOPERATIVE;
-    }
-    CONTRACTL_END;
-
-    EX_TRY
-    {
-        GCHeapUtilities::GetGCHeap()->GarbageCollect();
-
-        //
-        // It is very dangerous to wait for finalizer thread here if we are inside a wait 
-        // operation, as the wait operation might call into interop which calls this MDA
-        // and call into FinalizerThreadWait. In this case, we might run into infinite recursion: 
-        //   SynchronizationContext.Wait -> P/Invoke -> WaitForPendingFinalizer ->
-        //   SynchronizationContext.Wait ....
-        // 
-        // So, if we are inside a SyncContext.Wait, don't call out to FinalizerThreadWait
-        //
-        if (!GetThread()->HasThreadStateNC(Thread::TSNC_InsideSyncContextWait))
-            // It is possible that user code run as part of finalization will wait for this thread.
-            // To avoid deadlocks, we limit the wait time to 10 seconds (an arbitrary number).
-            FinalizerThread::FinalizerThreadWait(10 * 1000);
-    }
-    EX_CATCH
-    {
-        // Caller cannot take exceptions.
-    }
-    EX_END_CATCH(SwallowAllExceptions);
-}
-
-//
-// MdaCallbackOnCollectedDelegate
-//
-/*
-MdaCallbackOnCollectedDelegate::~MdaCallbackOnCollectedDelegate()
-{
-    WRAPPER_NO_CONTRACT;
-    
-    if (m_pList && m_size)
-    {
-        for (int i=0; i < m_size; i++)
-            ReplaceEntry(i, NULL);
-
-        delete[] m_pList;
-    }
-}
-*/
-
-void MdaCallbackOnCollectedDelegate::ReportViolation(MethodDesc* pMD)
-{
-    CONTRACTL
-    {
-        THROWS;
-        GC_TRIGGERS;
-        MODE_ANY;
-    }
-    CONTRACTL_END;
-
-    MdaXmlElement* pXml;
-    MdaXmlMessage msg(this->AsMdaAssistant(), TRUE, &pXml);
-    MdaXmlElement* pDelegate = pXml->AddChild(MdaElemDecl(Delegate));
-    StackSString delegateName;
-
-    if(pMD)
-    {
-        AsMdaAssistant()->OutputMethodDesc(pMD, pDelegate);
-        AsMdaAssistant()->ToString(delegateName, pMD);
-    }
-
-    msg.SendMessagef(MDARC_CALLBACK_ON_COLLECTED_DELEGATE, delegateName.GetUnicode());
-}
-
-void MdaCallbackOnCollectedDelegate::AddToList(UMEntryThunk* pEntryThunk)
-{
-    CONTRACTL
-    {
-        NOTHROW;
-        GC_NOTRIGGER;
-        MODE_ANY;
-        PRECONDITION(CheckPointer(pEntryThunk));
-    }
-    CONTRACTL_END;
-
-    // Get an index to use.
-    ULONG oldIndex = m_iIndex;
-    ULONG newIndex = oldIndex + 1;
-    if (newIndex >= (ULONG)m_size)
-        newIndex = 0;
-    
-    while ((ULONG)FastInterlockCompareExchange((LONG*)&m_iIndex, newIndex, oldIndex) != oldIndex)
-    {
-        oldIndex = m_iIndex;
-        newIndex = oldIndex + 1;
-        if (newIndex >= (ULONG)m_size)
-            newIndex = 0;
-    }
-
-    // We successfully incremented the index and can use the oldIndex value as our entry.
-    ReplaceEntry(oldIndex, pEntryThunk);
-}
-
-void MdaCallbackOnCollectedDelegate::ReplaceEntry(int index, UMEntryThunk* pET)
-{
-    CONTRACTL
-    {
-        NOTHROW;
-        GC_NOTRIGGER;
-        MODE_ANY;
-        PRECONDITION((index >= 0) && (index < m_size));
-        PRECONDITION(CheckPointer(m_pList));
-    }
-    CONTRACTL_END;
-    
-    if ((m_pList) && (m_size > index) && (index >= 0))
-    {
-        UMEntryThunk* pETTemp = m_pList[index];
-        while (FastInterlockCompareExchangePointer((LPVOID*)&m_pList[index], (LPVOID)pET, (LPVOID)pETTemp) != (LPVOID)pETTemp)
-        {
-            pETTemp = m_pList[index];
-        }
-        
-        if (NULL != pETTemp)
-        {
-            pETTemp->Terminate();
-        }
-    }
-}
-
-#ifdef FEATURE_COMINTEROP   
-
-void MdaInvalidMemberDeclaration::ReportViolation(ComCallMethodDesc *pCMD, OBJECTREF *pExceptionObj)
-{
-    CONTRACTL
-    {
-        NOTHROW;
-        GC_TRIGGERS;
-        MODE_COOPERATIVE;
-    }
-    CONTRACTL_END;
-
-    EX_TRY
-    {
-        MdaXmlElement* pXml;
-        MdaXmlMessage msg(this->AsMdaAssistant(), TRUE, &pXml);
-
-        TypeHandle th;
-        StackSString strMemberName;
-        StackSString strTypeName;
-        StackSString strMessage;
-
-        GetExceptionMessage(*pExceptionObj, strMessage);
-
-        if (pCMD->IsFieldCall())
-        {
-            FieldDesc *pFD = pCMD->GetFieldDesc();
-
-            th = pFD->GetFieldTypeHandleThrowing();
-            strMemberName.SetUTF8(pFD->GetName());
-            AsMdaAssistant()->OutputFieldDesc(pFD, pXml->AddChild(MdaElemDecl(Field)));
-        }
-        else
-        {
-            MethodDesc *pMD = pCMD->GetCallMethodDesc();
-
-            th = TypeHandle(pMD->GetMethodTable());
-            strMemberName.SetUTF8(pMD->GetName());
-            AsMdaAssistant()->OutputMethodDesc(pMD, pXml->AddChild(MdaElemDecl(Method)));        
-        }
-
-        th.GetName(strTypeName);
-
-        AsMdaAssistant()->OutputTypeHandle(th, pXml->AddChild(MdaElemDecl(Type)));
-        AsMdaAssistant()->OutputException(pExceptionObj, pXml->AddChild(MdaElemDecl(Exception)));
-            
-        msg.SendMessagef(MDARC_INVALID_MEMBER_DECLARATION, 
-            strMemberName.GetUnicode(), strTypeName.GetUnicode(), strMessage.GetUnicode());    
-    }
-    EX_CATCH
-    {
-        // Caller cannot take exceptions.
-    }
-    EX_END_CATCH(SwallowAllExceptions);
-}
-
-#endif //FEATURE_COMINTEROP
-
-
-//
-// MdaExceptionSwallowedOnCallFromCom
-//
-void MdaExceptionSwallowedOnCallFromCom::ReportViolation(MethodDesc *pMD, OBJECTREF *pExceptionObj)
-{
-    CONTRACTL
-    {
-        NOTHROW;
-        GC_TRIGGERS;
-        MODE_ANY;
-    }
-    CONTRACTL_END;
-
-    EX_TRY
-    {
-        StackSString strMessage;
-        StackSString strTypeName;
-        StackSString strMemberName;
-            
-        MdaXmlElement* pXml;
-        MdaXmlMessage msg(this->AsMdaAssistant(), TRUE, &pXml);
-
-        TypeHandle th = TypeHandle(pMD->GetMethodTable());
-
-        GetExceptionMessage(*pExceptionObj, strMessage);
-        th.GetName(strTypeName);
-        strMemberName.SetUTF8(pMD->GetName());
-
-        AsMdaAssistant()->OutputMethodDesc(pMD, pXml->AddChild(MdaElemDecl(Method)));        
-        AsMdaAssistant()->OutputTypeHandle(th, pXml->AddChild(MdaElemDecl(Type)));        
-        AsMdaAssistant()->OutputException(pExceptionObj, pXml->AddChild(MdaElemDecl(Exception)));
-            
-        msg.SendMessagef(MDARC_EXCEPTION_SWALLOWED_COM_TO_CLR, 
-            strMemberName.GetUnicode(), strTypeName.GetUnicode(), strMessage.GetUnicode());    
-    }
-    EX_CATCH
-    {
-        // Caller cannot take exceptions.
-    }
-    EX_END_CATCH(SwallowAllExceptions);
-}
-   
-    
-//
-// MdaInvalidVariant
-//
-void MdaInvalidVariant::ReportViolation()
-{
-    CONTRACTL
-    {
-        THROWS;
-        GC_TRIGGERS;
-        MODE_ANY;
-    }
-    CONTRACTL_END;
-
-    MdaXmlElement* pXml;
-    MdaXmlMessage msg(this->AsMdaAssistant(), TRUE, &pXml);
-
-    msg.SendMessagef(MDARC_INVALID_VARIANT);
-}
-
-
-//
-// MdaInvalidIUnknown
-//
-void MdaInvalidIUnknown::ReportViolation()
-{
-    CONTRACTL
-    {
-        THROWS;
-        GC_TRIGGERS;
-        MODE_ANY;
-    }
-    CONTRACTL_END;
-
-    MdaXmlElement* pXml;
-    MdaXmlMessage msg(this->AsMdaAssistant(), TRUE, &pXml);
-
-    msg.SendMessagef(MDARC_INVALID_IUNKNOWN);
-}
-
-
-//
-// MdaContextSwitchDeadlock
-//
-void MdaContextSwitchDeadlock::ReportDeadlock(LPVOID Origin, LPVOID Destination)
-{
-    CONTRACTL
-    {
-        NOTHROW;
-        GC_TRIGGERS;
-        MODE_ANY;
-    }
-    CONTRACTL_END;
-
-    if (g_fEEShutDown == 0)
-    {
-        EX_TRY
-        {
-            MdaXmlElement* pXml;
-            MdaXmlMessage msg(this->AsMdaAssistant(), TRUE, &pXml);
-
-            msg.SendMessagef(MDARC_CONTEXT_SWITCH_DEADLOCK, Origin, Destination);
-        }
-        EX_CATCH
-        {
-            // Caller cannot take exceptions.
-        }
-        EX_END_CATCH(SwallowAllExceptions);
-    }
-}
-
-
-//
-// MdaRaceOnRCWCleanup
-//
-void MdaRaceOnRCWCleanup::ReportViolation()
-{
-    CONTRACTL
-    {
-        THROWS;
-        GC_TRIGGERS;
-        MODE_ANY;
-    }
-    CONTRACTL_END;
-
-    MdaXmlElement* pXml;
-    MdaXmlMessage msg(this->AsMdaAssistant(), TRUE, &pXml);
-
-    msg.SendMessagef(MDARC_RCW_CLEANUP_RACE);
-}
-
-
-//
-// MdaFailedQI
-//
-void MdaFailedQI::ReportAdditionalInfo(HRESULT hr, RCW* pRCW, GUID iid, MethodTable* pMT)
-{
-    CONTRACTL
-    {
-        THROWS;
-        GC_TRIGGERS;
-        MODE_ANY;
-    }
-    CONTRACTL_END;
-
-    MdaXmlElement* pXml;
-    MdaXmlMessage msg(this->AsMdaAssistant(), TRUE, &pXml);
-    TypeHandle th(pMT);
-
-    SafeComHolder<IUnknown> pInnerUnk = pRCW->GetIUnknown(); 
-
-    // We are interested in the case where the QI fails because of wrong context.
-    if (!pRCW->IsFreeThreaded() && GetCurrentCtxCookie() != pRCW->GetWrapperCtxCookie())
-    {
-        // Try to change context and perform the QI in the new context again.
-        MdaFailedQIAssistantCallbackData    data;
-       
-        data.pWrapper   = pRCW;
-        data.iid        = iid;
-
-        pRCW->EnterContext(MdaFailedQIAssistantCallback, &data);
-        if (data.fSuccess)
-        {
-            // QI succeeds in the other context, i.e. the original QI fails because of wrong context.
-            pXml = AsMdaAssistant()->OutputTypeHandle(th, pXml->AddChild(MdaElemDecl(Type)));
-
-            // Stringize IID
-            WCHAR strNativeItfIID[39];
-            StringFromGUID2(iid, strNativeItfIID, sizeof(strNativeItfIID) / sizeof(WCHAR));
-
-            // Map HRESULT to a message
-            StackSString sszHR2Description;
-            GetHRMsg(hr, sszHR2Description);
-
-            // Format the HRESULT as a string
-            StackSString sszHR2Hex;
-            sszHR2Hex.Printf("%.8x", hr);
-
-            StackSString sszTypeName;
-            th.GetName(sszTypeName);
-            
-            msg.SendMessagef(MDARC_FAILED_QI, sszTypeName.GetUnicode(), strNativeItfIID, sszHR2Hex.GetUnicode(), sszHR2Description.GetUnicode());
-        }
-    }
-    else if (hr == E_NOINTERFACE)
-    {
-
-        // BUG: You'd have to check the registry to ensure that the proxy stub it's not actually there as opposed to the 
-        // COM object QI simply returning a failure code.
-    
-    /*
-        // Check if pInnerUnk is actually pointing to a proxy, i.e. that it is pointing to an address
-        // within the loaded ole32.dll image.  Note that WszGetModuleHandle does not increment the 
-        // ref count.
-        HINSTANCE hModOle32 = WszGetModuleHandle(OLE32DLL);
-        if (hModOle32 && IsIPInModule(hModOle32, (BYTE *)(*(BYTE **)(IUnknown*)pInnerUnk)))
-        {
-            pXml = AsMdaAssistant()->OutputTypeHandle(th, pXml->AddChild(MdaElemDecl(Type)));
-
-            WCHAR strGuid[40];
-            GuidToLPWSTR(iid, strGuid, 40);
-            msg.SendMessagef(MDARC_FAILED_QI, strGuid);
-        }
-   */
-    }
-}
-
-HRESULT MdaFailedQIAssistantCallback(LPVOID pData)
-{
-    CONTRACTL
-    {
-        NOTHROW;
-        GC_TRIGGERS;
-        MODE_PREEMPTIVE;
-        PRECONDITION(CheckPointer(pData));
-    }
-    CONTRACTL_END;
-    
-    HRESULT                 hr = E_FAIL;
-
-    BEGIN_EXTERNAL_ENTRYPOINT(&hr)
-    {
-        SafeComHolder<IUnknown> pDummyUnk;
-        
-        MdaFailedQIAssistantCallbackData    *pCallbackData = (MdaFailedQIAssistantCallbackData *)pData;
-        
-        // Initialize the fSuccess flag to false until we know for a fact the QI will succeed.
-        pCallbackData->fSuccess = FALSE;
-        
-        // QI for the requested interface.
-        hr = pCallbackData->pWrapper->SafeQueryInterfaceRemoteAware(pCallbackData->iid, &pDummyUnk);
-        
-        // If the QI call succeded then set the fSuccess flag to true.
-        if (SUCCEEDED(hr))
-            pCallbackData->fSuccess = TRUE;
-    }
-    END_EXTERNAL_ENTRYPOINT;
-    
-    return S_OK;        // Need to return S_OK so that the assert in CtxEntry::EnterContext() won't fire.
-}
-
-//
-// MdaDisconnectedContext
-//
-void MdaDisconnectedContext::ReportViolationDisconnected(LPVOID context, HRESULT hr)
-{
-    CONTRACTL
-    {
-        THROWS;
-        GC_TRIGGERS;
-        MODE_ANY;
-    }
-    CONTRACTL_END;
-
-    if (g_fEEShutDown == 0)
-    {
-        MdaXmlElement* pXml;
-        MdaXmlMessage msg(this->AsMdaAssistant(), TRUE, &pXml);
-
-        StackSString strHRMsg;
-        GetHRMsg(hr, strHRMsg);
-        
-        msg.SendMessagef(MDARC_DISCONNECTED_CONTEXT_1, context, strHRMsg.GetUnicode());
-    }
-}
-
-void MdaDisconnectedContext::ReportViolationCleanup(LPVOID context1, LPVOID context2, HRESULT hr)
-{
-    CONTRACTL
-    {
-        NOTHROW;
-        GC_TRIGGERS;
-        MODE_ANY;
-    }
-    CONTRACTL_END;
-
-    if (g_fEEShutDown == 0)
-    {
-        EX_TRY
-        {
-            MdaXmlElement* pXml;
-            MdaXmlMessage msg(this->AsMdaAssistant(), TRUE, &pXml);
-
-            StackSString strHRMsg;
-            GetHRMsg(hr, strHRMsg);
-
-            msg.SendMessagef(MDARC_DISCONNECTED_CONTEXT_2, context1, strHRMsg.GetUnicode(), context2);        
-        }
-        EX_CATCH
-        {
-            // Caller cannot take exceptions.
-        }
-        EX_END_CATCH(SwallowAllExceptions)
-    }
-}
-
-
-//
-// MdaInvalidApartmentStateChange
-//
-void MdaInvalidApartmentStateChange::ReportViolation(Thread* pThread, Thread::ApartmentState newstate, BOOL fAlreadySet)
-{
-    CONTRACTL
-    {
-        NOTHROW;
-        GC_TRIGGERS;
-        MODE_ANY;
-    }
-    CONTRACTL_END;
-    
-    EX_TRY
-    {
-        MdaXmlElement* pXml;
-        MdaXmlMessage msg(this->AsMdaAssistant(), TRUE, &pXml);
-
-        AsMdaAssistant()->OutputThread(pThread, pXml->AddChild(MdaElemDecl(Thread)));
-
-        if (fAlreadySet)
-        {
-            if (newstate == Thread::AS_InSTA)
-            {
-                msg.SendMessagef(MDARC_INVALID_APT_STATE_CHANGE_SET, W("STA"), W("MTA"));
-            }
-            else
-            {
-                msg.SendMessagef(MDARC_INVALID_APT_STATE_CHANGE_SET, W("MTA"), W("STA"));
-            }
-        }
-        else
-        {
-            if (newstate == Thread::AS_InSTA)
-            {
-                msg.SendMessagef(MDARC_INVALID_APT_STATE_CHANGE_NOTSET, W("STA"), W("MTA"));
-            }
-            else
-            {
-                msg.SendMessagef(MDARC_INVALID_APT_STATE_CHANGE_NOTSET, W("MTA"), W("STA"));
-            }
-        }
-    }
-    EX_CATCH
-    {
-        // Caller cannot take exceptions.
-    }
-    EX_END_CATCH(SwallowAllExceptions);
-}
-    
-//
-// MdaDllMainReturnsFalse
-//
-void MdaDllMainReturnsFalse::ReportError()
-{
-    CONTRACTL
-    {
-        THROWS;
-        GC_TRIGGERS;
-        MODE_ANY;
-    }
-    CONTRACTL_END;
-
-    MdaXmlElement* pXml;
-    MdaXmlMessage msg(this->AsMdaAssistant(), TRUE, &pXml);
-
-    msg.SendMessagef(MDARC_DLLMAIN_RETURNS_FALSE);
-}
-
-//
-// MdaOverlappedFreeError
-//
-void MdaOverlappedFreeError::ReportError(LPVOID pOverlapped)
-{
-    CONTRACTL
-    {
-        THROWS;
-        GC_TRIGGERS;
-        MODE_ANY;
-    }
-    CONTRACTL_END;
-
-    MdaXmlElement* pXml;
-    MdaXmlMessage msg(this->AsMdaAssistant(), TRUE, &pXml);
-
-    msg.SendMessagef(MDARC_INVALID_OVERLAPPED_FREE,
-            pOverlapped);
-}
-
-//
-// MdaInvalidOverlappedToPinvoke
-//
-
-// NOTE: the overlapped pointer needs to be named "overlapped". 
-// It is embedded in the (Args) and (ArgsUsed) sections.
-
-
-#define CREATE_WRAPPER_FUNCTION(DllName, Return, Flags, Name, Args, ArgsUsed)                        \
-    DllName##_##Name,
-enum {
-#include "invalidoverlappedwrappers.h"
-};
-#undef CREATE_WRAPPER_FUNCTION
-
-#define CREATE_WRAPPER_FUNCTION(DllName, Return, Flags, Name, Args, ArgsUsed)                               \
-Return Flags Mda_##Name Args                                                                                \
-{                                                                                                           \
-    CONTRACTL                                                                                               \
-    {                                                                                                       \
-        THROWS;                                                                                             \
-        GC_TRIGGERS;                                                                                        \
-        MODE_ANY;                                                                                           \
-    }                                                                                                       \
-    CONTRACTL_END;                                                                                          \
-    Return (Flags *old##Name) Args;                                                                         \
-    MdaInvalidOverlappedToPinvoke *pOverlapCheck = MDA_GET_ASSISTANT(InvalidOverlappedToPinvoke);           \
-    _ASSERTE(pOverlapCheck);                                                                                \
-    *(PVOID *)&(old##Name) = pOverlapCheck->CheckOverlappedPointer(DllName##_##Name, (LPVOID) overlapped);  \
-    return old##Name ArgsUsed;                                                                              \
-}
-#include "invalidoverlappedwrappers.h"
-#undef CREATE_WRAPPER_FUNCTION
-
-#define CREATE_WRAPPER_FUNCTION(DllName, Return, Flags, Name, Args, ArgsUsed)    \
-    { L#DllName W(".DLL"), L#Name, Mda_##Name, NULL, NULL },
-static MdaInvalidOverlappedToPinvoke::pinvoke_entry PInvokeTable[] = {
-#include "invalidoverlappedwrappers.h"
-};
-#undef CREATE_WRAPPER_FUNCTION
-
-void MdaInvalidOverlappedToPinvoke::Initialize(MdaXmlElement* pXmlInput)
-{
-    CONTRACTL
-    {
-        THROWS;
-        GC_TRIGGERS;
-        MODE_ANY;
-    }
-    CONTRACTL_END;
-
-    m_entries = PInvokeTable;
-    m_entryCount = sizeof(PInvokeTable) / sizeof(pinvoke_entry);
-    m_bJustMyCode = pXmlInput->GetAttributeValueAsBool(MdaAttrDecl(JustMyCode));    
-}
-
-BOOL MdaInvalidOverlappedToPinvoke::InitializeModuleFunctions(HINSTANCE hmod)
-{
-    CONTRACTL
-    {
-        THROWS;
-        GC_TRIGGERS;
-        MODE_ANY;
-    }
-    CONTRACTL_END;
-
-    // For every entry where m_moduleName matches moduleName, fill in m_hmod with hmod
-    // and fill in the m_realFunction pointer.
-
-    BOOL bFoundSomething = FALSE;
-
-    SString moduleNameFullPath, moduleName;
-    ClrGetModuleFileNameNoThrow(hmod,moduleNameFullPath);
-    // Strip any path info
-    SString::CIterator iM = moduleNameFullPath.End();
-    if (moduleNameFullPath.FindBack(iM, W('\\')))
-    {
-        iM++;
-        moduleName.Set(moduleNameFullPath, iM, moduleNameFullPath.End());
-    }
-
-    for (UINT i=0; i<m_entryCount; i++)
-    {
-        if (SString::_wcsicmp(m_entries[i].m_moduleName, moduleName.GetUnicode()) == 0)
-        {
-            if (m_entries[i].m_hmod == NULL)
-            {
-                SString moduleNameForLookup(m_entries[i].m_functionName);
-                StackScratchBuffer ansiVersion;                
-                m_entries[i].m_realFunction = GetProcAddress(hmod, moduleNameForLookup.GetANSI(ansiVersion));
-                m_entries[i].m_hmod = hmod;                
-            }
-            bFoundSomething = TRUE;
-        }
-    }
-
-    return bFoundSomething;
-}
-
-LPVOID MdaInvalidOverlappedToPinvoke::CheckOverlappedPointer(UINT index, LPVOID pOverlapped)
-{
-    CONTRACTL
-    {
-        THROWS;
-        GC_TRIGGERS;
-        MODE_ANY;
-    }
-    CONTRACTL_END;
-
-    MdaInvalidOverlappedToPinvoke::pinvoke_entry *pEntry = m_entries + index;
-
-    // pEntry should always be non-NULL, because we got the address of pvMdaFunction
-    // from the entries table in the first place.
-    _ASSERTE(pEntry);
-    if (pEntry == NULL)
-    {
-        return NULL;
-    }
-
-    // Is the overlapped pointer in the gc heap?
-    if (pOverlapped != NULL)
-    {
-        BOOL fHeapPointer;
-
-        {
-            GCX_COOP();
-            IGCHeap *pHeap = GCHeapUtilities::GetGCHeap();
-            fHeapPointer = pHeap->IsHeapPointer(pOverlapped);
-        }
-
-        if (!fHeapPointer)
-        {
-            // Output a message
-            MdaXmlElement* pXml;
-            MdaXmlMessage msg(this->AsMdaAssistant(), TRUE, &pXml);
-
-            msg.SendMessagef(MDARC_INVALID_OVERLAPPED_TO_PINVOKE, 
-                pOverlapped, 
-                pEntry->m_functionName,
-                pEntry->m_moduleName);
-        }
-    }
-    
-    return pEntry->m_realFunction;
-}
-
-// We want to hook the functions where it is in the user's code only, unless
-// the attribute JustMyCode is set to false. In that case, we want all 
-// occurances.
-BOOL MdaInvalidOverlappedToPinvoke::ShouldHook(MethodDesc *pMD)
-{
-    LIMITED_METHOD_CONTRACT;
-    return (m_bJustMyCode ? IsJustMyCode(pMD) : TRUE);
-}
-
-LPVOID MdaInvalidOverlappedToPinvoke::Register(HINSTANCE hmod,LPVOID pvTarget)
-{
-    CONTRACTL
-    {
-        THROWS;
-        GC_TRIGGERS;
-        MODE_ANY;
-    }
-    CONTRACTL_END;
-
-    // Quick lookup - do we have a matching target?
-    // walk our entries, looking for a match.
-    BOOL bNullModules = FALSE;
-    BOOL bSeenThisModule = FALSE;
-    
-    for (UINT i=0; i<m_entryCount; i++)
-    {
-        MdaInvalidOverlappedToPinvoke::pinvoke_entry *pEntry = m_entries + i;
-        if (pvTarget == pEntry->m_realFunction)
-        {
-            return pEntry->m_mdaFunction;
-        }
-        
-        bNullModules |= (pEntry->m_hmod == NULL);
-        bSeenThisModule |= (pEntry->m_hmod == hmod);
-    }
-    
-    // if we have some NULL targets, do we have a matching hmod?
-    // if so, 
-    if (bNullModules && !bSeenThisModule)
-    {
-        if (InitializeModuleFunctions(hmod))
-        {
-            // Search once more
-            for (UINT i=0; i<m_entryCount; i++)
-            {
-                pinvoke_entry *pEntry = m_entries + i;
-                if (pvTarget == pEntry->m_realFunction)
-                {
-                    return pEntry->m_mdaFunction;
-                }                
-            }
-        }
-    }
-
-    return NULL;
-}
-
-//
-// MdaPInvokeLog
-//
-BOOL MdaPInvokeLog::Filter(SString& sszDllName)
-{
-    CONTRACTL
-    {
-        THROWS;
-        GC_TRIGGERS;
-        MODE_ANY;
-    }
-    CONTRACTL_END;
-
-    MdaXmlElement* pXmlFilter = m_pXmlInput->GetChild(MdaElemDecl(Filter));  
-    if (!pXmlFilter)
-        return TRUE;
-
-    BOOL bFound = FALSE;
-    for (COUNT_T i = 0; i < pXmlFilter->GetChildren().GetCount(); i ++)
-    {
-        if (pXmlFilter->GetChildren()[i]->GetAttribute(MdaAttrDecl(DllName))->GetValueAsCSString()->EqualsCaseInsensitive(sszDllName))
-        {
-            bFound = TRUE;
-            break;
-        }
-    }
-
-   return bFound;
-}
-
-void MdaPInvokeLog::LogPInvoke(NDirectMethodDesc* pMD, HINSTANCE hMod)
-{   
-    CONTRACTL
-    {
-        NOTHROW;
-        GC_TRIGGERS;
-        MODE_ANY;
-    }
-    CONTRACTL_END;
-
-    EX_TRY
-    {
-        StackSString sszEntryPoint;
-        sszEntryPoint.SetUTF8(pMD->GetEntrypointName());
-
-        PathString szDllFullName ;
-        WCHAR szDrive[_MAX_PATH] = {0};
-        WCHAR szPath[_MAX_PATH] = {0};
-        WCHAR szFileName[_MAX_PATH] = {0};
-        WCHAR szExt[_MAX_PATH] = {0};
-        WszGetModuleFileName(hMod, szDllFullName);      
-        SplitPath(szDllFullName, szDrive, _MAX_PATH, szPath, _MAX_PATH, szFileName, _MAX_PATH, szExt, _MAX_PATH);
-
-        StackSString sszDllName;
-        sszDllName.Append(szFileName);
-        if (szExt)
-            sszDllName.Append(szExt);
-
-        if (Filter(sszDllName))
-        {
-            MdaXmlElement* pXml;
-            MdaXmlMessage msg(this->AsMdaAssistant(), FALSE, &pXml);
-            
-            MdaXmlElement* pMethod = pXml->AddChild(MdaElemDecl(Method));
-            AsMdaAssistant()->OutputMethodDesc(pMD, pMethod);
-
-            MdaXmlElement* pDllImport = pXml->AddChild(MdaElemDecl(DllImport));
-            pDllImport->AddAttributeSz(MdaAttrDecl(DllName), szDllFullName);
-            pDllImport->AddAttributeSz(MdaAttrDecl(EntryPoint), sszEntryPoint.GetUnicode());
-
-            msg.SendMessage();    
-        }
-    }
-    EX_CATCH
-    {
-        // Caller cannot take exceptions.
-    }
-    EX_END_CATCH(SwallowAllExceptions);
-}
-
-
-#ifdef _TARGET_X86_    
-//
-// MdaPInvokeStackImbalance
-//
-void MdaPInvokeStackImbalance::CheckStack(StackImbalanceCookie *pSICookie, DWORD dwPostEsp)
-{
-    CONTRACTL
-    {
-        THROWS;
-        GC_TRIGGERS;
-        MODE_ANY;
-    }
-    CONTRACTL_END;
-
-    DWORD dwEspAfterPushedArgs = pSICookie->m_dwSavedEsp;
-    DWORD dwEspBeforePushedArgs = dwEspAfterPushedArgs + pSICookie->m_dwStackArgSize;
-    BOOL bStackImbalance = false;
-
-    // Note: We use relaxed rules here depending on the NetFx40_PInvokeStackResilience compat switch in order to mimic 2.0 behavior.
-    switch (pSICookie->m_callConv & pmCallConvMask)
-    {
-        // Caller cleans stack
-        case pmCallConvCdecl:
-            if (dwPostEsp != dwEspAfterPushedArgs)
-            {
-                if (dwPostEsp != dwEspBeforePushedArgs)
-                {
-                    bStackImbalance = true;
-                }
-                else
-                {
-                    // If NetFx40_PInvokeStackResilience is on, ignore the case where we see that the callee cleaned the stack.
-                    BOOL fPreV4Method = pSICookie->m_pMD->GetModule()->IsPreV4Assembly();
-                    if (!g_pConfig->PInvokeRestoreEsp(fPreV4Method))
-                        bStackImbalance = true;
-                }
-            }
-            break;
-
-        // Callee cleans stack
-        case pmCallConvThiscall:
-        case pmCallConvWinapi:
-        case pmCallConvStdcall:
-            if (dwPostEsp != dwEspBeforePushedArgs)
-            {
-                if (dwPostEsp != dwEspAfterPushedArgs)
-                {
-                    bStackImbalance = true;
-                }
-                else
-                {
-                    // If NetFx40_PInvokeStackResilience is on, ignore the case where we see that the callee did not clean the stack
-                    BOOL fPreV4Method = pSICookie->m_pMD->GetModule()->IsPreV4Assembly();
-                    if (!g_pConfig->PInvokeRestoreEsp(fPreV4Method))
-                        bStackImbalance = true;
-                }
-            }
-            break;
-
-        // Unsupported calling convention
-        case pmCallConvFastcall:
-        default:
-            _ASSERTE(!"Unsupported calling convention");
-            break;
-    }
-        
-    if (!bStackImbalance)
-        return;
-
-    MdaXmlElement* pXml;
-    MdaXmlMessage msg(this->AsMdaAssistant(), TRUE, &pXml);
-    MdaXmlElement* pMethod = pXml->AddChild(MdaElemDecl(Method));
-    AsMdaAssistant()->OutputMethodDesc(pSICookie->m_pMD, pMethod);
-    
-    StackSString sszMethodName;
-    msg.SendMessagef(MDARC_PINVOKE_SIGNATURE_MISMATCH, AsMdaAssistant()->ToString(sszMethodName, pSICookie->m_pMD).GetUnicode());
-}
-#endif
-
-    
-//
-// MdaJitCompilationStart
-//
-void MdaJitCompilationStart::Initialize(MdaXmlElement* pXmlInput)
-{
-    CONTRACTL
-    {
-        THROWS;
-        GC_TRIGGERS;
-        MODE_ANY;
-    }
-    CONTRACTL_END;
-
-    m_bBreak = pXmlInput->GetAttributeValueAsBool(MdaAttrDecl(Break));
-    MdaXmlElement* pXmlMethodFilter = pXmlInput->GetChild(MdaElemDecl(Methods));
-    m_pMethodFilter = NULL;
-
-    if (pXmlMethodFilter)
-    {
-        m_pMethodFilter = new MdaQuery::CompiledQueries();
-        MdaQuery::Compile(pXmlMethodFilter, m_pMethodFilter);
-    }
-}
-
-void MdaJitCompilationStart::NowCompiling(MethodDesc* pMD)
-{
-    CONTRACTL
-    {
-        THROWS;
-        GC_TRIGGERS;
-        MODE_ANY;
-    }
-    CONTRACTL_END;
-
-    if (m_pMethodFilter && !m_pMethodFilter->Test(pMD))
-        return;
-
-    MdaXmlElement* pXml;
-    MdaXmlMessage msg(this->AsMdaAssistant(), m_bBreak, &pXml);
-    
-    MdaXmlElement* pMethod = pXml->AddChild(MdaElemDecl(Method));
-    AsMdaAssistant()->OutputMethodDesc(pMD, pMethod);
-    
-    msg.SendMessage();
-}
-
-//
-// MdaLoadFromContext
-//
-void MdaLoadFromContext::NowLoading(IAssembly** ppIAssembly, StackCrawlMark *pCallerStackMark)
-{
-    CONTRACTL
-    {
-        THROWS;
-        GC_TRIGGERS;
-        MODE_ANY;
-    }
-    CONTRACTL_END;
-
-    if (ppIAssembly && *ppIAssembly) {
-
-        // Send an MDA if this assembly was loaded in the LoadFrom context
-        if ((*ppIAssembly)->GetFusionLoadContext() == LOADCTX_TYPE_LOADFROM) {
-             // Apply MDA filtering
-            if (g_pDebugInterface && pCallerStackMark && ManagedDebuggingAssistants::IsManagedDebuggerAttached()) {
-                MethodDesc *pMethodDesc = NULL;
-                {
-                    GCX_COOP();
-                    pMethodDesc = SystemDomain::GetCallersMethod(pCallerStackMark, NULL);
-                }
-                if (pMethodDesc && !g_pDebugInterface->IsJMCMethod(pMethodDesc->GetModule(), pMethodDesc->GetMemberDef()))
-                    return;
-            }
-
-            MdaXmlElement *pXml;
-            MdaXmlMessage msg(this->AsMdaAssistant(), TRUE, &pXml);
-
-            MdaXmlElement *pXmlAssembly = pXml->AddChild(MdaElemDecl(AssemblyInfo));
-            
-            StackSString sszAssemblyName;
-            StackSString sszCodeBase;
-            SafeComHolder<IAssemblyName> pNameDef;
-
-            if (FAILED((*ppIAssembly)->GetAssemblyNameDef(&pNameDef))) {
-                return;
-            }
-
-            if ((!FusionBind::GetAssemblyNameStringProperty(pNameDef, ASM_NAME_NAME, sszAssemblyName)) ||
-                (!FusionBind::GetAssemblyNameStringProperty(pNameDef, ASM_NAME_CODEBASE_URL, sszCodeBase))) {
-                return;
-            }
-            
-            pXmlAssembly->AddAttributeSz(MdaAttrDecl(DisplayName), sszAssemblyName.GetUnicode());
-            pXmlAssembly->AddAttributeSz(MdaAttrDecl(CodeBase), sszCodeBase.GetUnicode());
-                   
-            msg.SendMessagef(MDARC_LOAD_FROM_CONTEXT, sszAssemblyName.GetUnicode(), sszCodeBase.GetUnicode());
-        }
-    }
-}
-
-const LPCWSTR ContextIdName[] =
-{
-    W("Load"),
-    W("LoadFrom"),
-    W("Anonymous")
-};
-
-//
-// MdaBindingFailure
-//
-void MdaBindingFailure::BindFailed(AssemblySpec *pSpec, OBJECTREF *pExceptionObj)
-{
-    CONTRACTL
-    {
-        THROWS;
-        GC_TRIGGERS;
-        MODE_ANY;
-    }
-    CONTRACTL_END;
-
-    MdaXmlElement *pXml;
-    MdaXmlMessage msg(this->AsMdaAssistant(), TRUE, &pXml);
-
-    MdaXmlElement *pXmlAssembly = pXml->AddChild(MdaElemDecl(AssemblyInfo));
-
-    DWORD dwAppDomainId;
-    SString sszAssemblyName;
-    SString sszCodeBase;
-    SString sszMessage;
-    int iBindingContext;
-    HRESULT hr;
-
-    // determine AppDomain ID
-    AppDomain *appDomain = pSpec->GetAppDomain();
-    if (appDomain) {     
-        dwAppDomainId = appDomain->GetId().m_dwId;
-    } else {
-        dwAppDomainId = 0;
-    }
-    pXmlAssembly->AddAttributeInt(MdaAttrDecl(AppDomainId), dwAppDomainId);
-
-    // determine Assembly display name
-    LPCSTR assemblyName = pSpec->GetName();
-    if (assemblyName && assemblyName[0]) {
-        sszAssemblyName.SetASCII(assemblyName);
-    }
-    pXmlAssembly->AddAttributeSz(MdaAttrDecl(DisplayName), sszAssemblyName.GetUnicode());
-
-    // determine Assembly code base
-    if (pSpec->GetCodeBase() && pSpec->GetCodeBase()[0]) {
-        sszCodeBase.Set(pSpec->GetCodeBase());
-    }
-    pXmlAssembly->AddAttributeSz(MdaAttrDecl(CodeBase), sszCodeBase.GetUnicode());
-
-    // retrieve the exception message.
-    GetExceptionMessage(*pExceptionObj, sszMessage);
-
-    // determine failing HRESULT  
-    hr = GetExceptionHResult(*pExceptionObj);
-    pXmlAssembly->AddAttributeInt(MdaAttrDecl(HResult), hr);
-
-    // determine binding context Assembly would have been loaded in (based on parent)
-    IAssembly* pParentAssembly = pSpec->GetParentIAssembly();
-    if (pParentAssembly) {
-        iBindingContext = pParentAssembly->GetFusionLoadContext();
-    } else {
-
-        // if the parent hasn't been set but the code base has, it's in LoadFrom
-        iBindingContext = LOADCTX_TYPE_LOADFROM;
-    }
-    pXmlAssembly->AddAttributeInt(MdaAttrDecl(BindingContextId), iBindingContext);
-
-    // Make sure the binding context ID isn't larger then our ID to name lookup table.
-    _ASSERTE(iBindingContext < COUNTOF(ContextIdName));
-    
-    if (sszAssemblyName.IsEmpty())
-    {
-        _ASSERTE(!sszCodeBase.IsEmpty());
-        msg.SendMessagef(MDARC_BINDING_FAILURE_CODEBASE_ONLY, sszCodeBase.GetUnicode(), 
-                         ContextIdName[iBindingContext], dwAppDomainId, sszMessage.GetUnicode());
-    }
-    else if (sszCodeBase.IsEmpty())
-    {
-        _ASSERTE(!sszAssemblyName.IsEmpty());
-        msg.SendMessagef(MDARC_BINDING_FAILURE_DISPLAYNAME_ONLY, sszAssemblyName.GetUnicode(),  
-                         ContextIdName[iBindingContext], dwAppDomainId, sszMessage.GetUnicode());
-    }
-    else 
-    {
-        msg.SendMessagef(MDARC_BINDING_FAILURE, sszAssemblyName.GetUnicode(), sszCodeBase.GetUnicode(), 
-                         ContextIdName[iBindingContext], dwAppDomainId, sszMessage.GetUnicode());
-    }
-}
-
-//
-// MdaNotMarshalable
-//
-void MdaNotMarshalable::ReportViolation()
-{
-    CONTRACTL
-    {
-        THROWS;
-        GC_TRIGGERS;
-        MODE_ANY;
-    }
-    CONTRACTL_END;
-
-    MdaXmlElement* pXml;
-    MdaXmlMessage msg(this->AsMdaAssistant(), TRUE, &pXml);
-
-    msg.SendMessagef(MDARC_NOTMARSHALABLE);
-}
-
-
-//
-// MdaMarshalCleanupError
-//
-void MdaMarshalCleanupError::ReportErrorThreadCulture(OBJECTREF *pExceptionObj)
-{
-    CONTRACTL
-    {
-        NOTHROW;
-        GC_TRIGGERS;
-        MODE_ANY;
-    }
-    CONTRACTL_END;
-
-    EX_TRY
-    {
-        MdaXmlElement* pXml;
-        MdaXmlMessage msg(this->AsMdaAssistant(), TRUE, &pXml);
-
-        // retrieve the exception message.
-        SString sszMessage;
-        GetExceptionMessage(*pExceptionObj, sszMessage);
-
-        msg.SendMessagef(MDARC_MARSHALCLEANUPERROR_THREADCULTURE, sszMessage.GetUnicode());
-    }
-    EX_CATCH
-    {
-    }
-    EX_END_CATCH(SwallowAllExceptions);
-}
-
-void MdaMarshalCleanupError::ReportErrorSafeHandleProp(OBJECTREF *pExceptionObj)
-{
-    CONTRACTL
-    {
-        NOTHROW;
-        GC_TRIGGERS;
-        MODE_ANY;
-    }
-    CONTRACTL_END;
-
-    EX_TRY
-    {
-        MdaXmlElement* pXml;
-        MdaXmlMessage msg(this->AsMdaAssistant(), TRUE, &pXml);
-
-        // retrieve the exception message.
-        SString sszMessage;
-        GetExceptionMessage(*pExceptionObj, sszMessage);
-
-        msg.SendMessagef(MDARC_MARSHALCLEANUPERROR_SAFEHANDLEPROP, sszMessage.GetUnicode());
-    }
-    EX_CATCH
-    {
-    }
-    EX_END_CATCH(SwallowAllExceptions);
-}
-
-void MdaMarshalCleanupError::ReportErrorCustomMarshalerCleanup(TypeHandle typeCustomMarshaler, OBJECTREF *pExceptionObj)
-{
-    CONTRACTL
-    {
-        NOTHROW;
-        GC_TRIGGERS;
-        MODE_ANY;
-    }
-    CONTRACTL_END;
-
-    EX_TRY
-    {
-            
-        MdaXmlElement* pXml;
-        MdaXmlMessage msg(this->AsMdaAssistant(), TRUE, &pXml);
-
-        // retrieve the exception message.
-        SString sszMessage;
-        GetExceptionMessage(*pExceptionObj, sszMessage);
-
-        // Retrieve the type name.
-        StackSString sszType;
-        typeCustomMarshaler.GetName(sszType);
-
-        msg.SendMessagef(MDARC_MARSHALCLEANUPERROR_CUSTOMCLEANUP, sszType.GetUnicode(), sszMessage.GetUnicode());
-    }
-    EX_CATCH
-    {
-    }
-    EX_END_CATCH(SwallowAllExceptions);
-}
-
-//
-// MdaLoaderLock
-//
-void MdaLoaderLock::ReportViolation(HINSTANCE hInst)
-{
-    CONTRACTL
-    {
-        NOTHROW;
-        GC_TRIGGERS;
-        MODE_ANY;
-    }
-    CONTRACTL_END;
-
-    EX_TRY
-    {
-        MdaXmlElement* pXml;
-        MdaXmlMessage msg(this->AsMdaAssistant(), TRUE, &pXml);
-
-        DWORD cName = 0;
-        PathString szName;
-        if (hInst)
-        {
-            cName = WszGetModuleFileName(hInst, szName);
-        }
-
-        if (cName)
-        {
-            msg.SendMessagef(MDARC_LOADER_LOCK_DLL, szName);
-        }
-        else
-        {
-            msg.SendMessagef(MDARC_LOADER_LOCK);
-        }
-    }
-    EX_CATCH
-    {
-        // Caller cannot take exceptions.
-    }
-    EX_END_CATCH(SwallowAllExceptions);
-}
-
-
-//
-// MdaReentrancy
-//
-void MdaReentrancy::ReportViolation()
-{
-    CONTRACTL
-    {
-        NOTHROW;
-        GC_TRIGGERS;
-        MODE_ANY;
-    }
-    CONTRACTL_END;
-
-    EX_TRY
-    {
-        MdaXmlElement* pXml;
-        MdaXmlMessage msg(this->AsMdaAssistant(), TRUE, &pXml);
-
-        msg.SendMessagef(MDARC_REENTRANCY);
-    }
-    EX_CATCH
-    {
-        // Caller cannot take exceptions.
-    }
-    EX_END_CATCH(SwallowAllExceptions);
-}
-
-//
-// MdaAsynchronousThreadAbort
-//
-void MdaAsynchronousThreadAbort::ReportViolation(Thread *pCallingThread, Thread *pAbortedThread)
-{
-    CONTRACTL
-    {
-        NOTHROW;
-        GC_TRIGGERS;
-        MODE_ANY;
-    }
-    CONTRACTL_END;
-
-    EX_TRY
-    {
-        MdaXmlElement* pXml;
-        MdaXmlMessage msg(this->AsMdaAssistant(), TRUE, &pXml);
-
-        AsMdaAssistant()->OutputThread(pCallingThread, pXml->AddChild(MdaElemDecl(CallingThread)));
-        AsMdaAssistant()->OutputThread(pAbortedThread, pXml->AddChild(MdaElemDecl(AbortedThread)));
-
-        msg.SendMessagef(MDARC_ASYNCHRONOUS_THREADABORT, pCallingThread->GetOSThreadId(), pAbortedThread->GetOSThreadId());
-    }
-    EX_CATCH
-    {
-        // Caller cannot take exceptions.
-    }
-    EX_END_CATCH(SwallowAllExceptions);
-}
-
-    
-//
-// MdaAsynchronousThreadAbort
-//
-void MdaDangerousThreadingAPI::ReportViolation(__in_z WCHAR *apiName)
-{
-    CONTRACTL
-    {
-        THROWS;
-        GC_TRIGGERS;
-        MODE_ANY;
-    }
-    CONTRACTL_END;
-
-    MdaXmlElement* pXml;
-    MdaXmlMessage msg(this->AsMdaAssistant(), TRUE, &pXml);
-
-    msg.SendMessagef(MDARC_DANGEROUS_THREADINGAPI, apiName);
-}
-
-    
-//
-// MdaReportAvOnComRelease
-//
-
-void MdaReportAvOnComRelease::ReportHandledException(RCW* pRCW)
-{
-    CONTRACTL
-    {
-        NOTHROW;
-        GC_TRIGGERS;
-        MODE_ANY;
-    }
-    CONTRACTL_END;
-
-    EX_TRY
-    {
-        FAULT_NOT_FATAL();
-    
-        // TODO: comment this code...
-        MdaXmlElement* pXml;
-        MdaXmlMessage msg(this->AsMdaAssistant(), TRUE, &pXml);
-
-        if (pRCW)
-        {
-            LPVOID vtablePtr = pRCW->GetVTablePtr();
-            msg.SendMessagef(MDARC_REPORT_AV_ON_COM_RELEASE_WITH_VTABLE, vtablePtr);
-        }
-        else
-        {
-            msg.SendMessagef(MDARC_REPORT_AV_ON_COM_RELEASE);
-        }
-    }
-    EX_CATCH
-    {
-        // Caller cannot take exceptions.
-    }
-    EX_END_CATCH(SwallowAllExceptions);
-}
-
-void MdaInvalidFunctionPointerInDelegate::ReportViolation(LPVOID pFunc)
-{
-    CONTRACTL
-    {
-        THROWS;
-        GC_TRIGGERS;
-        MODE_ANY;
-    }
-    CONTRACTL_END;
-
-    MdaXmlElement* pXml;
-    MdaXmlMessage msg(this->AsMdaAssistant(), TRUE, &pXml);
-
-    msg.SendMessagef(MDARC_INVALID_FUNCTION_PTR_IN_DELEGATE, pFunc);
-}
-
-//
-// MdaDirtyCastAndCallOnInterface
-//
-
-void MdaDirtyCastAndCallOnInterface::ReportViolation(IUnknown* pUnk)
-{
-    CONTRACTL
-    {
-        THROWS;
-        GC_TRIGGERS;
-        MODE_ANY;
-    }
-    CONTRACTL_END;
-
-    MdaXmlElement* pXml;
-    MdaXmlMessage msg(this->AsMdaAssistant(), TRUE, &pXml);
-
-    msg.SendMessagef(MDARC_DIRTY_CAST_AND_CALL_ON_INTERFACE);
-}
-
-//
-// MdaFatalExecutionEngineError
-//
-void MdaFatalExecutionEngineError::ReportFEEE(TADDR addrOfError, HRESULT hrError)
-{
-    CONTRACTL
-    {
-        NOTHROW;
-        GC_TRIGGERS;
-        MODE_ANY;
-    }
-    CONTRACTL_END;
-
-    EX_TRY
-    {
-        MdaXmlElement* pXml;
-        MdaXmlMessage msg(this->AsMdaAssistant(), TRUE, &pXml);
-
-        DWORD tid = GetCurrentThreadId();
-
-        msg.SendMessagef(MDARC_FATAL_EXECUTION_ENGINE_ERROR, addrOfError, tid, hrError);        
-    }
-    EX_CATCH
-    {
-        // Caller cannot take exceptions.
-    }
-    EX_END_CATCH(SwallowAllExceptions);
-}
-
-
-//
-// MdaInvalidCERCall
-//
-void MdaInvalidCERCall::ReportViolation(MethodDesc* pCallerMD, MethodDesc *pCalleeMD, DWORD dwOffset)
-{
-    CONTRACTL
-    {
-        THROWS;
-        GC_TRIGGERS;
-        MODE_ANY;
-    }
-    CONTRACTL_END;
-
-    MdaXmlElement* pXml;
-    MdaXmlMessage msg(this->AsMdaAssistant(), FALSE, &pXml);
-
-    AsMdaAssistant()->OutputMethodDesc(pCalleeMD, pXml->AddChild(MdaElemDecl(Method)));
-    AsMdaAssistant()->OutputCallsite(pCallerMD, dwOffset, pXml->AddChild(MdaElemDecl(Callsite)));
-
-    StackSString sszCalleeMethodName(SString::Utf8, pCalleeMD->GetName());
-    StackSString sszCallerMethodName(SString::Utf8, pCallerMD->GetName());
-    msg.SendMessagef(MDARC_INVALID_CER_CALL, sszCallerMethodName.GetUnicode(), dwOffset, sszCalleeMethodName.GetUnicode());
-}
-
-
-//
-// MdaVirtualCERCall
-//
-void MdaVirtualCERCall::ReportViolation(MethodDesc* pCallerMD, MethodDesc *pCalleeMD, DWORD dwOffset)
-{
-    CONTRACTL
-    {
-        THROWS;
-        GC_TRIGGERS;
-        MODE_ANY;
-    }
-    CONTRACTL_END;
-
-    MdaXmlElement* pXml;
-    MdaXmlMessage msg(this->AsMdaAssistant(), FALSE, &pXml);
-
-    AsMdaAssistant()->OutputMethodDesc(pCalleeMD, pXml->AddChild(MdaElemDecl(Method)));
-    AsMdaAssistant()->OutputCallsite(pCallerMD, dwOffset, pXml->AddChild(MdaElemDecl(Callsite)));
-
-    StackSString sszCalleeMethodName(SString::Utf8, pCalleeMD->GetName());
-    StackSString sszCallerMethodName(SString::Utf8, pCallerMD->GetName());
-    msg.SendMessagef(MDARC_VIRTUAL_CER_CALL, sszCallerMethodName.GetUnicode(), dwOffset, sszCalleeMethodName.GetUnicode());
-}
-
-
-//
-// MdaOpenGenericCERCall
-//
-void MdaOpenGenericCERCall::ReportViolation(MethodDesc* pMD)
-{
-    CONTRACTL
-    {
-        THROWS;
-        GC_TRIGGERS;
-        MODE_ANY;
-    }
-    CONTRACTL_END;
-
-    MdaXmlElement* pXml;
-    MdaXmlMessage msg(this->AsMdaAssistant(), FALSE, &pXml);
-
-    AsMdaAssistant()->OutputMethodDesc(pMD, pXml->AddChild(MdaElemDecl(Method)));
-
-    StackSString sszMethodName(SString::Utf8, pMD->GetName());
-    msg.SendMessagef(MDARC_OPENGENERIC_CER_CALL, sszMethodName.GetUnicode());
-}
-
-
-//
-// MdaIllegalPrepareConstrainedRegion
-//
-void MdaIllegalPrepareConstrainedRegion::ReportViolation(MethodDesc* pMD, DWORD dwOffset)
-{
-    CONTRACTL
-    {
-        THROWS;
-        GC_TRIGGERS;
-        MODE_ANY;
-    }
-    CONTRACTL_END;
-
-    MdaXmlElement* pXml;
-    MdaXmlMessage msg(this->AsMdaAssistant(), FALSE, &pXml);
-
-    AsMdaAssistant()->OutputCallsite(pMD, dwOffset, pXml->AddChild(MdaElemDecl(Callsite)));
-
-    StackSString sszMethodName(SString::Utf8, pMD->GetName());
-    msg.SendMessagef(MDARC_ILLEGAL_PCR, sszMethodName.GetUnicode(), dwOffset);
-}
-
-
-//
-// MdaReleaseHandleFailed
-//
-void MdaReleaseHandleFailed::ReportViolation(TypeHandle th, LPVOID lpvHandle)
-{
-    CONTRACTL
-    {
-        THROWS;
-        GC_TRIGGERS;
-        MODE_ANY;
-    }
-    CONTRACTL_END;
-
-    MdaXmlElement* pXml;
-    MdaXmlMessage msg(this->AsMdaAssistant(), TRUE, &pXml);
-
-    AsMdaAssistant()->OutputTypeHandle(th, pXml->AddChild(MdaElemDecl(Type)));
-
-    StackSString sszHandle;
-    sszHandle.Printf(W("0x%p"), lpvHandle);
-    pXml->AddChild(MdaElemDecl(Handle))->AddAttributeSz(MdaAttrDecl(Value), sszHandle.GetUnicode());
-
-    StackSString sszType;
-    th.GetName(sszType);
-    msg.SendMessagef(MDARC_SAFEHANDLE_CRITICAL_FAILURE, sszType.GetUnicode(), lpvHandle);
-}
-
-
-#ifdef FEATURE_COMINTEROP   
-//
-// MdaReleaseHandleFailed
-//
-void MdaNonComVisibleBaseClass::ReportViolation(MethodTable *pMT, BOOL fForIDispatch)
-{
-    CONTRACTL
-    {
-        THROWS;
-        GC_TRIGGERS;
-        MODE_ANY;
-    }
-    CONTRACTL_END;
-
-    MdaXmlElement* pXml;
-    MdaXmlMessage msg(this->AsMdaAssistant(), TRUE, &pXml);
-
-    TypeHandle thDerived = TypeHandle(pMT);
-    TypeHandle thBase = thDerived.GetParent();
-    
-    while (IsTypeVisibleFromCom(thBase))
-        thBase = thBase.GetParent();
-
-    // If we get there, one of the parents must be non COM visible.
-    _ASSERTE(!thBase.IsNull());
-
-    AsMdaAssistant()->OutputTypeHandle(thDerived, pXml->AddChild(MdaElemDecl(DerivedType)));
-    AsMdaAssistant()->OutputTypeHandle(thBase, pXml->AddChild(MdaElemDecl(BaseType)));
-
-    SString strDerivedClassName;
-    SString strBaseClassName;
-
-    thDerived.GetName(strDerivedClassName);
-    thBase.GetName(strBaseClassName);
-
-
-    msg.SendMessagef(fForIDispatch ? MDARC_NON_COMVISIBLE_BASE_CLASS_IDISPATCH : MDARC_NON_COMVISIBLE_BASE_CLASS_CLASSITF,
-       strDerivedClassName.GetUnicode(), strBaseClassName.GetUnicode());
-}
-#endif //FEATURE_COMINTEROP
-
-
-#ifdef _DEBUG
-//
-// MdaXmlValidationError
-//
-void MdaXmlValidationError::ReportError(MdaSchema::ValidationResult* pValidationResult)
-{
-    CONTRACTL
-    {
-        THROWS;
-        GC_TRIGGERS;
-        MODE_ANY;
-        DEBUG_ONLY;
-    }
-    CONTRACTL_END;
-    PRECONDITION(CheckPointer(pValidationResult->m_pViolatingElement));
-    PRECONDITION(CheckPointer(pValidationResult->m_pViolatedElement));
-
-    MdaXmlElement* pXml;
-    MdaXmlMessage msg(this->AsMdaAssistant(), FALSE, &pXml);
-
-    pXml->AddChild(MdaElemDecl(ViolatingXml))->AddChild(pValidationResult->m_pXmlRoot);
-    pValidationResult->m_pSchema->ToXml(pXml->AddChild(MdaElemDecl(ViolatedXsd)));    
-    
-    msg.SendMessage(W("The following XML does not match its schema."));
-}
-#endif
-
-
-//
-// InvalidConfigFile
-//
-void MdaInvalidConfigFile::ReportError(MdaElemDeclDef configFile)
-{
-    CONTRACTL
-    {
-        THROWS;
-        GC_TRIGGERS;
-        MODE_ANY;
-        DEBUG_ONLY;
-    }
-    CONTRACTL_END;
-
-    MdaXmlElement* pXml;
-    MdaXmlMessage report(this->AsMdaAssistant(), TRUE, &pXml);
-
-    LPCWSTR szConfigFile = MdaSchema::GetElementName(configFile);
-    pXml->AddAttributeSz(MdaAttrDecl(ConfigFile), szConfigFile);  
-    
-    report.SendMessagef(MDARC_INVALID_CONFIG_FILE, szConfigFile);
-}
-
-#endif
-#endif //MDA_SUPPORTED
diff --git a/src/vm/mdaassistants.h b/src/vm/mdaassistants.h
deleted file mode 100644 (file)
index 7b83fae..0000000
+++ /dev/null
@@ -1,827 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-
-#ifndef _MDA_ASSISTANTS_
-#define _MDA_ASSISTANTS_
-  
-#include "common.h"
-#include "mda.h"
-#include "mlinfo.h"
-#include <dbginterface.h>
-
-/*
-
-//-----------------------------------------------------------------------------
-// How to add a new MDA:
-//-----------------------------------------------------------------------------
-
-1) add a new class that derives from MdaAssistant to src\vm\mdaAssistants.h
-- the new class should have some function to report the error (we'll call it ReportXYZ()).  
-The function is not virtual, and so can take any needed parameters and will be called explicitly wherever you want to fire the MDA.
-
-2) Add the new implementation to src\vm\mdaAssistants.cpp
-See the other report functions for an example (eg, MdaLoaderLock::ReportViolation)
-
-3) The MDA contains a user-description string. This must be localized, and so it comes from a resource file.
-    - add a new resource ID to src\dlls\mscorrc\Resource.h (eg, MDARC_REPORT_AV_ON_COM_RELEASE)
-
-4) add the actual text to src\dlls\mscorrc\Mscorrc.rc. 
-    - add a #define MDARC_XYZ_MSG string. This is a printf format string and may contain parameters.
-    - add an entry into the MDARC stringtable like "MDARC_XYZ_MSG MDAARC_XYZ"
-
-5) In order to get an instance of the MDA:
-    Use a construct like:
-        MdaFatalExecutionEngineError * pMDA = MDA_GET_ASSISTANT(FatalExecutionEngineError);
-            
-    The macro parameter is the MDA class name minus the "MDA" prefix.
-    This may return null if the MDA is not available.
-
-6) Update mdaAssistantSchemas.inl
-
-7) Add it to any appropriate groups in mdaGroups.inl. Please be sure to follow each groups policy.
-
-8) Write a test for it.
-*/
-
-#ifdef MDA_SUPPORTED 
-
-// MDA classes do not derive from MdaAssistant in the type system, but, rather, use this macro to
-// ensure that their layout is identical to what it would be had they derived from MdaAssistant.  
-// This allows them to be "aggregates", which C++ will allow to be initialized at compile time. 
-// This means that we must explicitly coerce from a derived type to the "base" type as needed.
-//
-// Note that the layout is asserted to be correct at compile time via the MDA_DEFINE_ASSISTANT
-// macro.
-#define MDA_ASSISTANT_BASE_MEMBERS                          \
-    MdaAssistant* AsMdaAssistant()                          \
-    {                                                       \
-        LIMITED_METHOD_CONTRACT;                            \
-        return (MdaAssistant*)this;                         \
-    }                                                       \
-    void Enable()                                           \
-    {                                                       \
-        LIMITED_METHOD_CONTRACT;                            \
-        ManagedDebuggingAssistants::Enable(                 \
-            m_assistantDeclDef, this->AsMdaAssistant());    \
-    }                                                       \
-    MdaElemDeclDef m_assistantDeclDef;                      \
-    MdaElemDeclDef m_assistantMsgDeclDef;                   \
-    bool m_bSuppressDialog                                  \
-
-
-//
-// MdaFramework
-// 
-class MdaFramework
-{
-public:
-    void Initialize(MdaXmlElement* pXmlInput);     
-    void DumpDiagnostics();    
-
-    MDA_ASSISTANT_BASE_MEMBERS;
-    BOOL m_disableAsserts;
-    BOOL m_dumpSchemaSchema;
-    BOOL m_dumpAssistantSchema;
-    BOOL m_dumpAssistantMsgSchema;
-    BOOL m_dumpMachineConfig;
-    BOOL m_dumpAppConfig;   
-};
-
-
-//
-// MdaJitCompilationStart
-// 
-class MdaJitCompilationStart
-{
-public:
-    void Initialize(MdaXmlElement* pXmlInput); 
-    void NowCompiling(MethodDesc* pMethodDesc);
-
-    MDA_ASSISTANT_BASE_MEMBERS;
-    MdaQuery::CompiledQueries* m_pMethodFilter;
-    BOOL m_bBreak;
-};
-
-
-//
-// MdaLoadFromContext
-//
-class MdaLoadFromContext
-{
-public:
-    void Initialize(MdaXmlElement* pXmlInput) { LIMITED_METHOD_CONTRACT; } 
-    void NowLoading(IAssembly** ppIAssembly, StackCrawlMark *pCallerStackMark);
-
-    MDA_ASSISTANT_BASE_MEMBERS;
-};
-
-
-// MdaBindingFailure
-//
-class MdaBindingFailure
-{
-public:
-    void Initialize(MdaXmlElement* pXmlInput) { LIMITED_METHOD_CONTRACT; }
-    void BindFailed(AssemblySpec *pSpec, OBJECTREF *pExceptionObj);
-
-    MDA_ASSISTANT_BASE_MEMBERS;
-};
-
-
-//
-// MdaPInvokeLog
-//
-class MdaPInvokeLog
-{
-public:
-    void Initialize(MdaXmlElement* pXmlInput) { LIMITED_METHOD_CONTRACT; m_pXmlInput = pXmlInput; }
-    BOOL Filter(SString& sszDllName);
-    void LogPInvoke(NDirectMethodDesc* pMd, HINSTANCE hMod);
-
-    MDA_ASSISTANT_BASE_MEMBERS;
-    MdaXmlElement* m_pXmlInput;
-};
-
-
-//
-// MdaOverlappedFreeError
-//
-class MdaOverlappedFreeError
-{
-public:
-    void Initialize(MdaXmlElement* pXmlInput) { LIMITED_METHOD_CONTRACT; }
-    void ReportError(LPVOID pOverlapped);
-
-    MDA_ASSISTANT_BASE_MEMBERS;
-};
-
-//
-// MdaInvalidOverlappedToPinvoke
-//
-class MdaInvalidOverlappedToPinvoke
-{
-public:
-    void Initialize(MdaXmlElement* pXmlInput);
-
-    BOOL ShouldHook(MethodDesc *pMD);
-    
-    // Called when setting up the pinvoke target
-    LPVOID Register(HINSTANCE hmod,LPVOID pvTarget);
-
-    // Logs the MDA error if the overlapped pointer isn't in the gc heap
-    LPVOID CheckOverlappedPointer(UINT index,LPVOID pOverlapped);
-
-    struct pinvoke_entry
-    {    
-        LPCWSTR m_moduleName;
-        LPCWSTR m_functionName;
-        LPVOID m_mdaFunction;
-        LPVOID m_realFunction;
-        HINSTANCE m_hmod;    
-
-        void Init(LPCWSTR moduleName, LPCWSTR functionName, LPVOID mdaFunction)
-        {
-            WRAPPER_NO_CONTRACT;
-            m_moduleName = moduleName;
-            m_functionName = functionName;
-            m_mdaFunction = mdaFunction;
-            m_realFunction = NULL;
-            m_hmod = NULL;
-        }
-    };
-    BOOL InitializeModuleFunctions(HINSTANCE hmod);
-
-    MDA_ASSISTANT_BASE_MEMBERS;
-    pinvoke_entry *m_entries;
-    UINT m_entryCount;
-    BOOL m_bJustMyCode;
-};
-
-#ifdef _TARGET_X86_    
-//
-// PInvokeStackImbalance
-//
-struct StackImbalanceCookie
-{
-    enum
-    {
-        // combined with the unmanaged calling convention (code:pmCallConvMask) in
-        // code:m_callConv if the unmanaged target has a floating point return value
-        HAS_FP_RETURN_VALUE = 0x80000000
-    };
-
-    // Filled in by stub generated by code:NDirectMethodDesc.GenerateStubForMDA or
-    // code:COMDelegate::GenerateStubForMDA:
-    MethodDesc   *m_pMD;            // dispatching MD (P/Invoke or delegate's Invoke)
-    LPVOID        m_pTarget;        // target address
-    DWORD         m_dwStackArgSize; // number of arg bytes pushed on stack
-    DWORD         m_callConv;       // unmanaged calling convention, highest bit indicates FP return
-
-    // Pre-call ESP as recorded by PInvokeStackImbalanceHelper:
-    DWORD         m_dwSavedEsp;
-};
-
-class MdaPInvokeStackImbalance
-{
-public:
-    void Initialize(MdaXmlElement* pXmlInput) { LIMITED_METHOD_CONTRACT; }
-    void CheckStack(StackImbalanceCookie *pSICookie, DWORD dwPostESP);
-
-    MDA_ASSISTANT_BASE_MEMBERS;
-};
-#endif
-
-
-//
-// DllMainReturnsFalse
-//
-class MdaDllMainReturnsFalse
-{
-public:
-    void Initialize(MdaXmlElement* pXmlInput) { LIMITED_METHOD_CONTRACT; }
-    void ReportError();
-
-    MDA_ASSISTANT_BASE_MEMBERS;
-};
-
-
-
-//
-// MdaModuloObjectHashcode 
-//
-class MdaModuloObjectHashcode
-{
-public:
-    void Initialize(MdaXmlElement* pXmlInput)   
-    { 
-        CONTRACTL
-        {
-            THROWS;
-            GC_NOTRIGGER;
-            MODE_ANY;
-        }
-        CONTRACTL_END;
-        
-        m_modulus = pXmlInput->GetAttribute(MdaAttrDecl(Modulus))->GetValueAsInt32();
-        if (m_modulus <= 0)
-            m_modulus = 1;
-    }
-
-    INT32 GetModulo() { LIMITED_METHOD_CONTRACT; _ASSERTE(m_modulus > 0); return m_modulus; }
-
-    MDA_ASSISTANT_BASE_MEMBERS;
-    INT32 m_modulus;
-};
-
-
-//
-// MdaGCUnmanagedToManaged
-//
-class MdaGcUnmanagedToManaged
-{
-public:
-    void Initialize(MdaXmlElement* pXmlInput) { LIMITED_METHOD_CONTRACT; }
-    void TriggerGC(); // calls to GC.Collect & GC.WaitForPendingFinalizers are also generated to IL stubs
-
-    MDA_ASSISTANT_BASE_MEMBERS;
-};
-
-
-//
-// MdaGCManagedToUnmanaged
-//
-class MdaGcManagedToUnmanaged
-{
-public:
-    void Initialize(MdaXmlElement* pXmlInput) { LIMITED_METHOD_CONTRACT; }
-    void TriggerGC(); // calls to GC.Collect & GC.WaitForPendingFinalizers are also generated to IL stubs
-
-    MDA_ASSISTANT_BASE_MEMBERS;
-};
-
-
-//
-// MdaLoaderLock
-//
-class MdaLoaderLock
-{
-public:
-    void Initialize(MdaXmlElement* pXmlInput) { LIMITED_METHOD_CONTRACT; }
-    void ReportViolation(HINSTANCE hInst);
-
-    MDA_ASSISTANT_BASE_MEMBERS;
-};
-
-
-//
-// MdaReentrancy
-//
-class MdaReentrancy
-{
-public:
-    void Initialize(MdaXmlElement* pXmlInput) { LIMITED_METHOD_CONTRACT; }
-    void ReportViolation();
-
-    MDA_ASSISTANT_BASE_MEMBERS;
-};
-
-
-//
-// MdaAsynchronousThreadAbort
-//
-class MdaAsynchronousThreadAbort
-{
-public:
-    void Initialize(MdaXmlElement* pXmlInput) { LIMITED_METHOD_CONTRACT; }
-    void ReportViolation(Thread *pCallingThread, Thread *pAbortedThread);
-
-    MDA_ASSISTANT_BASE_MEMBERS;
-};
-
-
-//
-// MdaAsynchronousThreadAbort
-//
-class MdaDangerousThreadingAPI
-{
-public:
-    void Initialize(MdaXmlElement* pXmlInput) { LIMITED_METHOD_CONTRACT; }
-    void ReportViolation(__in_z WCHAR *apiName);
-
-    MDA_ASSISTANT_BASE_MEMBERS;
-};
-
-
-//
-// MdaReportAvOnComRelease
-//
-class MdaReportAvOnComRelease
-{
-public:
-    void Initialize(MdaXmlElement* pXmlInput)
-    { 
-        CONTRACTL
-        {
-            THROWS;
-            GC_NOTRIGGER;
-            MODE_ANY;
-        }
-        CONTRACTL_END;
-        m_allowAv = pXmlInput->GetAttribute(MdaAttrDecl(AllowAv))->GetValueAsBool();
-    }
-
-    void ReportHandledException(RCW* pRCW);
-
-    BOOL AllowAV() { LIMITED_METHOD_CONTRACT; return m_allowAv; }
-
-    MDA_ASSISTANT_BASE_MEMBERS;
-    BOOL m_allowAv;
-};
-
-
-
-//
-// MdaFatalExecutionEngineError
-// 
-class MdaFatalExecutionEngineError
-{
-public:
-    void Initialize(MdaXmlElement* pXmlInput)
-    {
-        WRAPPER_NO_CONTRACT;
-    }
-
-    // Report a FatalExecutionEngine error. 
-    // It is assumed to be on the current thread.
-    void ReportFEEE(TADDR addrOfError, HRESULT hrError);
-
-    MDA_ASSISTANT_BASE_MEMBERS;
-};
-
-//
-// MdaCallbackOnCollectedDelegate
-//
-class MdaCallbackOnCollectedDelegate
-{
-public:
-    void Initialize(MdaXmlElement* pXmlInput)
-    {
-        CONTRACTL
-        {
-            THROWS;
-            GC_NOTRIGGER;
-            MODE_ANY;
-        }
-        CONTRACTL_END;
-
-        m_size = pXmlInput->GetAttribute(MdaAttrDecl(ListSize))->GetValueAsInt32();
-        if (m_size < 50)
-            m_size = 1000;
-
-        if (m_size > 2000)
-            m_size = 1000;
-
-        m_pList = new UMEntryThunk*[m_size];
-        memset(m_pList, 0, sizeof(UMEntryThunk*) * m_size);
-    }
-
-    void ReportViolation(MethodDesc* pMD);
-    void AddToList(UMEntryThunk* pEntryThunk);
-
-private:
-    void ReplaceEntry(int index, UMEntryThunk* pET);
-    
-public:
-    MDA_ASSISTANT_BASE_MEMBERS;
-    UMEntryThunk**      m_pList;
-    int                 m_iIndex;
-    int                 m_size;
-};
-
-//
-// InvalidMemberDeclaration
-//
-class MdaInvalidMemberDeclaration
-{
-public:
-    void Initialize(MdaXmlElement* pXmlInput) { LIMITED_METHOD_CONTRACT; }
-    
-#ifdef FEATURE_COMINTEROP
-    void ReportViolation(ComCallMethodDesc *pCMD, OBJECTREF *pExceptionObj);
-#endif //FEATURE_COMINTEROP
-
-    MDA_ASSISTANT_BASE_MEMBERS;
-};
-    
-
-//
-// MdaExceptionSwallowedOnCallFromCom
-//
-class MdaExceptionSwallowedOnCallFromCom
-{
-public:
-    void Initialize(MdaXmlElement* pXmlInput) { LIMITED_METHOD_CONTRACT; }
-    void ReportViolation(MethodDesc *pMD, OBJECTREF *pExceptionObj);
-
-    MDA_ASSISTANT_BASE_MEMBERS;
-};
-
-
-//
-// MdaInvalidVariant
-//
-class MdaInvalidVariant
-{
-public:
-    void Initialize(MdaXmlElement* pXmlInput) { LIMITED_METHOD_CONTRACT; }
-    void ReportViolation();
-
-    MDA_ASSISTANT_BASE_MEMBERS;
-};
-
-
-//
-// MdaInvalidApartmentStateChange
-//
-class MdaInvalidApartmentStateChange
-{
-public:
-    void Initialize(MdaXmlElement* pXmlInput) { LIMITED_METHOD_CONTRACT; }
-    void ReportViolation(Thread* pThread, Thread::ApartmentState state, BOOL fAlreadySet);
-
-    MDA_ASSISTANT_BASE_MEMBERS;
-};
-
-
-
-//
-// MdaFailedQI
-//
-HRESULT MdaFailedQIAssistantCallback(LPVOID pData);
-
-typedef struct
-{
-    RCW*             pWrapper;
-    IID              iid;
-    BOOL             fSuccess;
-} MdaFailedQIAssistantCallbackData;
-
-#define OLE32DLL    W("ole32.dll")
-
-class MdaFailedQI
-{
-public:
-    void Initialize(MdaXmlElement* pXmlInput) { LIMITED_METHOD_CONTRACT; }
-    void ReportAdditionalInfo(HRESULT hr, RCW* pRCW, GUID iid, MethodTable* pMT); 
-
-    MDA_ASSISTANT_BASE_MEMBERS;
-};
-
-
-//
-// MdaDisconnectedContext
-//
-class MdaDisconnectedContext
-{
-public:
-    void Initialize(MdaXmlElement* pXmlInput) { LIMITED_METHOD_CONTRACT; }
-    void ReportViolationDisconnected(LPVOID context, HRESULT hr);
-    void ReportViolationCleanup(LPVOID context1, LPVOID context2, HRESULT hr);
-
-    MDA_ASSISTANT_BASE_MEMBERS;
-};
-
-
-//
-// MdaNotMarshalable
-//
-class MdaNotMarshalable
-{
-public:
-    void Initialize(MdaXmlElement* pXmlInput) { LIMITED_METHOD_CONTRACT; }
-    void ReportViolation();
-
-    MDA_ASSISTANT_BASE_MEMBERS;
-};
-
-
-
-//
-// MdaMarshalCleanupError
-//
-class MdaMarshalCleanupError
-{
-public:
-    void Initialize(MdaXmlElement* pXmlInput) { LIMITED_METHOD_CONTRACT; }
-    void ReportErrorCustomMarshalerCleanup(TypeHandle typeCustomMarshaler, OBJECTREF *pExceptionObj);
-
-    MDA_ASSISTANT_BASE_MEMBERS;
-};
-
-
-//
-// MdaInvalidIUnknown
-//
-class MdaInvalidIUnknown
-{
-public:
-    void Initialize(MdaXmlElement* pXmlInput) { LIMITED_METHOD_CONTRACT; }
-    void ReportViolation();
-
-    MDA_ASSISTANT_BASE_MEMBERS;
-};
-
-
-//
-// MdaContextSwitchDeadlock
-//
-class MdaContextSwitchDeadlock
-{
-public:
-    void Initialize(MdaXmlElement* pXmlInput) { LIMITED_METHOD_CONTRACT; }
-    void ReportDeadlock(LPVOID Origin, LPVOID Destination);
-
-    MDA_ASSISTANT_BASE_MEMBERS;
-};
-
-
-//
-// MdaRaceOnRCWCleanup
-//
-class MdaRaceOnRCWCleanup
-{
-public:
-    void Initialize(MdaXmlElement* pXmlInput) { LIMITED_METHOD_CONTRACT; }
-    void ReportViolation();
-
-    MDA_ASSISTANT_BASE_MEMBERS;
-};
-
-//
-// InvalidFunctionPointerInDelegate
-//
-class MdaInvalidFunctionPointerInDelegate
-{
-public:
-    void Initialize(MdaXmlElement* pXmlInput) {LIMITED_METHOD_CONTRACT; }
-    void ReportViolation(LPVOID pFunc);    
-
-    MDA_ASSISTANT_BASE_MEMBERS;
-};
-
-
-//
-// DirtyCastAndCallOnInterface
-//
-class MdaDirtyCastAndCallOnInterface
-{
-public:
-    void Initialize(MdaXmlElement* pXmlInput) {LIMITED_METHOD_CONTRACT; }
-    void ReportViolation(IUnknown* pUnk);    
-
-    MDA_ASSISTANT_BASE_MEMBERS;
-};
-
-
-//
-// InvalidCERCall
-//
-class MdaInvalidCERCall
-{
-public:
-    void Initialize(MdaXmlElement* pXmlInput) { LIMITED_METHOD_CONTRACT; }
-    void ReportViolation(MethodDesc* pCallerMD, MethodDesc *pCalleeMD, DWORD dwOffset);
-
-    MDA_ASSISTANT_BASE_MEMBERS;
-};
-
-
-
-//
-// VirtualCERCall
-//
-class MdaVirtualCERCall
-{
-public:
-    void Initialize(MdaXmlElement* pXmlInput) { LIMITED_METHOD_CONTRACT; }
-    void ReportViolation(MethodDesc* pCallerMD, MethodDesc *pCalleeMD, DWORD dwOffset);
-
-    MDA_ASSISTANT_BASE_MEMBERS;
-};
-
-
-
-//
-// OpenGenericCERCall
-//
-class MdaOpenGenericCERCall
-{
-public:
-    void Initialize(MdaXmlElement* pXmlInput) { LIMITED_METHOD_CONTRACT; }
-    void ReportViolation(MethodDesc* pMD);
-
-    MDA_ASSISTANT_BASE_MEMBERS;
-};
-
-
-
-//
-// IllegalPrepareConstrainedRegion
-//
-class MdaIllegalPrepareConstrainedRegion
-{
-public:
-    void Initialize(MdaXmlElement* pXmlInput) { LIMITED_METHOD_CONTRACT; }
-    void ReportViolation(MethodDesc* pMD, DWORD dwOffset);
-
-    MDA_ASSISTANT_BASE_MEMBERS;
-};
-
-
-
-//
-// ReleaseHandleFailed
-//
-class MdaReleaseHandleFailed
-{
-public:
-    void Initialize(MdaXmlElement* pXmlInput) { LIMITED_METHOD_CONTRACT; }
-    void ReportViolation(TypeHandle th, LPVOID lpvHandle);
-
-    MDA_ASSISTANT_BASE_MEMBERS;
-};
-
-
-//
-// NonComVisibleBaseClass
-//
-class MdaNonComVisibleBaseClass
-{
-public:
-    void Initialize(MdaXmlElement* pXmlInput) { LIMITED_METHOD_CONTRACT; }
-#ifdef FEATURE_COMINTEROP   
-    void ReportViolation(MethodTable *pMT, BOOL fForIDispatch);
-#endif //FEATURE_COMINTEROP
-
-    MDA_ASSISTANT_BASE_MEMBERS;
-};
-    
-//
-// MdaXmlValidator
-//
-class MdaXmlValidator
-{
-public:
-    void Initialize(MdaXmlElement* pXmlInput) { LIMITED_METHOD_CONTRACT; }
-
-    MDA_ASSISTANT_BASE_MEMBERS;
-};
-
-
-#ifdef _DEBUG
-//
-// MdaXmlValidationError 
-//
-class MdaXmlValidationError
-{
-public:    
-    void Initialize(MdaXmlElement* pXml) { LIMITED_METHOD_CONTRACT; }
-
-public:
-    void ReportError(MdaSchema::ValidationResult* pValidationResult);
-
-    MDA_ASSISTANT_BASE_MEMBERS;
-};
-#endif
-
-
-//
-// MdaInvalidConfigFile 
-//
-class MdaInvalidConfigFile
-{
-public:    
-    void Initialize(MdaXmlElement* pXml) { LIMITED_METHOD_CONTRACT; }
-
-public:
-    void ReportError(MdaElemDeclDef configFile);
-
-    MDA_ASSISTANT_BASE_MEMBERS;
-};
-
-class ValidateMdaAssistantLayout
-{
-    static_assert_no_msg(sizeof(MdaAssistant) == 3);
-#define MDA_VALIDATE_MEMBER_LAYOUT
-#include "mdaschema.inl"
-#undef MDA_VALIDATE_MEMBER_LAYOUT
-};
-
-//
-// MdaStaticHeap
-//
-
-typedef struct
-{
-    // This array is always live.  Checking whether an assistant is enabled is 
-    // simply a fetch from this array.
-    MdaAssistant*               m_assistants[MdaElemDef(AssistantMax)];
-
-    // This pointer will point to the m_mda memory region, where the actual 
-    // ManagedDebuggingAssistants instance lives.  It may be null if we no MDAs
-    // were enabled.
-    ManagedDebuggingAssistants* m_pMda;
-    BYTE                        m_mda[sizeof(ManagedDebuggingAssistants)];
-
-#define MDA_ASSISTANT_HEAP_RAW
-#include "mdaschema.inl"
-#undef  MDA_ASSISTANT_HEAP_RAW
-
-    void DisableAll()
-    {
-        LIMITED_METHOD_CONTRACT;
-        memset(&m_assistants, 0, sizeof(m_assistants));
-    }
-}
-MdaStaticHeap;
-typedef DPTR(MdaStaticHeap) PTR_MdaStaticHeap;
-extern MdaStaticHeap g_mdaStaticHeap;
-
-
-// static
-FORCEINLINE void ManagedDebuggingAssistants::Enable(MdaElemDeclDef assistantDeclDef, MdaAssistant* pMda)
-{
-    g_mdaStaticHeap.m_assistants[assistantDeclDef] = pMda;
-}
-
-#ifndef DACCESS_COMPILE
-FORCEINLINE MdaAssistant* ManagedDebuggingAssistants::GetAssistant(MdaElemDeclDef id)
-{
-    WRAPPER_NO_CONTRACT; 
-
-    // If this assert fires, you should consider using GET_ASSISTANT_EX / TRIGGER_ASSISTANT_EX
-    _ASSERTE((g_pDebugInterface == NULL) || !g_pDebugInterface->ThisIsHelperThread());
-
-    return g_mdaStaticHeap.m_assistants[id];
-}
-
-FORCEINLINE MdaAssistant* ManagedDebuggingAssistants::GetAssistantEx(MdaElemDeclDef id)
-{
-    WRAPPER_NO_CONTRACT; 
-
-    MdaAssistant* pMda = g_mdaStaticHeap.m_assistants[id];
-    if ((pMda != NULL) && ((g_pDebugInterface == NULL) || !g_pDebugInterface->ThisIsHelperThread()))
-        return pMda;
-
-    return NULL;
-}
-#endif // DACCESS_COMPILE
-
-void TriggerGCForMDAInternal();
-
-#endif // MDA_SUPPORTED 
-#endif // _MDA_ASSISTANTS_
-
-
diff --git a/src/vm/mdaassistantschemas.inl b/src/vm/mdaassistantschemas.inl
deleted file mode 100644 (file)
index 39e0527..0000000
+++ /dev/null
@@ -1,601 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-
-    //
-    // Assistants
-    //
-    
-//    ************************************************
-//        PLEASE KEEP MDAS IN ALPHABETICAL ORDER (starting after AsynchronousThreadAbort)
-//    ************************************************
-
-
-    // Framework
-    MDA_DEFINE_ASSISTANT(Framework, NULL)
-        // Input
-        MDA_DEFINE_INPUT(Framework)
-#ifdef _DEBUG
-        MDA_XSD_OPTIONAL()
-            MDA_XSD_ELEMENT(Diagnostics)
-                MDA_XSD_ATTRIBUTE_DEFAULT(DumpAssistantMsgSchema, BOOL, W("false"))
-                MDA_XSD_ATTRIBUTE_DEFAULT(DumpAssistantSchema, BOOL, W("false"))
-                MDA_XSD_ATTRIBUTE_DEFAULT(DumpSchemaSchema, BOOL, W("false"))
-            MDA_XSD_ELEMENT_END(Diagnostics)           
-        MDA_XSD_OPTIONAL_END()
-        MDA_XSD_ATTRIBUTE_DEFAULT(DisableAsserts, BOOL, FALSE)
-#endif 
-        MDA_DEFINE_INPUT_END(Framework)
-        // Output
-        MDA_DEFINE_OUTPUT(Framework)
-        MDA_DEFINE_OUTPUT_END(Framework)         
-    MDA_DEFINE_ASSISTANT_END(Framework)   
-        
-    // AsynchronousThreadAbort
-    MDA_DEFINE_ASSISTANT(AsynchronousThreadAbort, NULL)
-        // Input
-        MDA_DEFINE_INPUT_AS_SWITCH(AsynchronousThreadAbort)
-        // Output
-        MDA_DEFINE_OUTPUT(AsynchronousThreadAbort)
-            MDA_XSD_ONCE()
-                MDA_XSD_ELEMENT_REFTYPE(CallingThread, ThreadType)
-                MDA_XSD_ELEMENT_REFTYPE(AbortedThread, ThreadType)
-            MDA_XSD_ONCE_END()        
-        MDA_DEFINE_OUTPUT_END(AsynchronousThreadAbort)         
-    MDA_DEFINE_ASSISTANT_END(AsynchronousThreadAbort)
-
-    // BindingFailure
-    MDA_DEFINE_ASSISTANT(BindingFailure, NULL)
-        // Input
-        MDA_DEFINE_INPUT_AS_SWITCH(BindingFailure)
-        // Output
-        MDA_DEFINE_OUTPUT(BindingFailure)
-            MDA_XSD_ONCE()
-                MDA_XSD_ELEMENT(AssemblyInfo)
-                    MDA_XSD_ATTRIBUTE_REQ(AppDomainId, INT32)
-                    MDA_XSD_ATTRIBUTE_REQ(DisplayName, SString)
-                    MDA_XSD_ATTRIBUTE_REQ(CodeBase, SString)
-                    MDA_XSD_ATTRIBUTE_REQ(HResult, INT32)
-                    MDA_XSD_ATTRIBUTE_REQ(BindingContextId, INT32)
-                MDA_XSD_ELEMENT_END(AssemblyInfo)
-            MDA_XSD_ONCE_END()
-        MDA_DEFINE_OUTPUT_END(BindingFailure)         
-    MDA_DEFINE_ASSISTANT_END(BindingFailure)
-
-    // CallbackOnCollectedDelegate
-    MDA_DEFINE_ASSISTANT(CallbackOnCollectedDelegate, NULL)
-        // Input
-        MDA_DEFINE_INPUT(CallbackOnCollectedDelegate)
-            MDA_XSD_ATTRIBUTE_DEFAULT(ListSize, INT32, W("1000"))
-        MDA_DEFINE_INPUT_END(CallbackOnCollectedDelegate)
-        // Output
-        MDA_DEFINE_OUTPUT(CallbackOnCollectedDelegate)
-            MDA_XSD_ONCE()
-                MDA_XSD_ELEMENT_REFTYPE(Delegate, MethodType)
-            MDA_XSD_ONCE_END()
-        MDA_DEFINE_OUTPUT_END(CallbackOnCollectedDelegate)
-    MDA_DEFINE_ASSISTANT_END(CallbackOnCollectedDelegate)
-
-    // ContextSwitchDeadlock
-    MDA_DEFINE_ASSISTANT(ContextSwitchDeadlock, NULL)
-        // Input
-        MDA_DEFINE_INPUT_AS_SWITCH(ContextSwitchDeadlock)
-        // Output
-        MDA_DEFINE_OUTPUT(ContextSwitchDeadlock)
-        MDA_DEFINE_OUTPUT_END(ContextSwitchDeadlock)      
-    MDA_DEFINE_ASSISTANT_END(ContextSwitchDeadlock)
-
-    // DangerousThreadingAPI
-    MDA_DEFINE_ASSISTANT(DangerousThreadingAPI, NULL)
-        // Input
-        MDA_DEFINE_INPUT_AS_SWITCH(DangerousThreadingAPI)
-        // Output
-        MDA_DEFINE_OUTPUT(DangerousThreadingAPI)
-        MDA_DEFINE_OUTPUT_END(DangerousThreadingAPI)         
-    MDA_DEFINE_ASSISTANT_END(DangerousThreadingAPI)  
-
-    // DirtyCastAndCallOnInterface
-    MDA_DEFINE_ASSISTANT(DirtyCastAndCallOnInterface, NULL)
-        // Input
-        MDA_DEFINE_INPUT_AS_SWITCH(DirtyCastAndCallOnInterface)
-        // Output
-        MDA_DEFINE_OUTPUT(DirtyCastAndCallOnInterface)
-        MDA_DEFINE_OUTPUT_END(DirtyCastAndCallOnInterface)      
-    MDA_DEFINE_ASSISTANT_END(DirtyCastAndCallOnInterface)
-
-    // DisconnectedContext
-    MDA_DEFINE_ASSISTANT(DisconnectedContext, NULL)
-        // Input
-        MDA_DEFINE_INPUT_AS_SWITCH(DisconnectedContext)
-        // Output
-        MDA_DEFINE_OUTPUT(DisconnectedContext)
-        MDA_DEFINE_OUTPUT_END(DisconnectedContext)      
-    MDA_DEFINE_ASSISTANT_END(DisconnectedContext)
-
-    // DllMainReturnsFalse
-    MDA_DEFINE_ASSISTANT(DllMainReturnsFalse, NULL)
-        // Input
-        MDA_DEFINE_INPUT_AS_SWITCH(DllMainReturnsFalse)
-        // Output
-        MDA_DEFINE_OUTPUT(DllMainReturnsFalse)
-        MDA_DEFINE_OUTPUT_END(DllMainReturnsFalse)
-    MDA_DEFINE_ASSISTANT_END(DllMainReturnsFalse)   
-
-    // ExceptionSwallowedOnCallFromCom
-    MDA_DEFINE_ASSISTANT(ExceptionSwallowedOnCallFromCom, NULL)       
-        // Input
-        MDA_DEFINE_INPUT(ExceptionSwallowedOnCallFromCom)
-        MDA_DEFINE_INPUT_END(ExceptionSwallowedOnCallFromCom)
-        // Output
-        MDA_DEFINE_OUTPUT(ExceptionSwallowedOnCallFromCom)
-            MDA_XSD_ONCE()
-                MDA_XSD_ELEMENT__REFTYPE(Method, MethodType)
-                MDA_XSD_ELEMENT__REFTYPE(Type, TypeType)
-                MDA_XSD_ELEMENT_REFTYPE(Exception, ExceptionType)
-            MDA_XSD_ONCE_END()
-        MDA_DEFINE_OUTPUT_END(ExceptionSwallowedOnCallFromCom)
-    MDA_DEFINE_ASSISTANT_END(ExceptionSwallowedOnCallFromCom)
-
-    // FailedQI
-    MDA_DEFINE_ASSISTANT(FailedQI, NULL)
-        // Input
-        MDA_DEFINE_INPUT_AS_SWITCH(FailedQI)
-        // Output
-        MDA_DEFINE_OUTPUT(FailedQI)
-            MDA_XSD_ONCE()
-                MDA_XSD_ELEMENT__REFTYPE(Type, TypeType)
-            MDA_XSD_ONCE_END()       
-        MDA_DEFINE_OUTPUT_END(FailedQI)      
-    MDA_DEFINE_ASSISTANT_END(FailedQI)
-    
-    // FatalExecutionEngineError
-    MDA_DEFINE_ASSISTANT(FatalExecutionEngineError, NULL)   
-        // Input
-        MDA_DEFINE_INPUT_AS_SWITCH(FatalExecutionEngineError)
-        // Output
-        MDA_DEFINE_OUTPUT(FatalExecutionEngineError)
-        MDA_DEFINE_OUTPUT_END(FatalExecutionEngineError)         
-    MDA_DEFINE_ASSISTANT_END(FatalExecutionEngineError)      
-
-    // GcManagedToUnmanaged
-    MDA_DEFINE_ASSISTANT(GcManagedToUnmanaged, NULL)
-        // Input
-        MDA_DEFINE_INPUT_AS_SWITCH(GcManagedToUnmanaged)
-    MDA_DEFINE_ASSISTANT_END(GcManagedToUnmanaged)
-
-    // GcUnmanagedToManaged
-    MDA_DEFINE_ASSISTANT(GcUnmanagedToManaged, NULL)
-        // Input
-        MDA_DEFINE_INPUT_AS_SWITCH(GcUnmanagedToManaged)
-    MDA_DEFINE_ASSISTANT_END(GcUnmanagedToManaged)
-
-    // IllegalPrepareConstrainedRegion
-    MDA_DEFINE_ASSISTANT(IllegalPrepareConstrainedRegion, NULL)
-        // Input
-        MDA_DEFINE_INPUT_AS_SWITCH(IllegalPrepareConstrainedRegion)
-        // Output
-        MDA_DEFINE_OUTPUT(IllegalPrepareConstrainedRegion)
-            MDA_XSD_ONCE()
-                MDA_XSD_ELEMENT__REFTYPE(Callsite, MethodAndOffsetType)
-            MDA_XSD_ONCE_END()
-        MDA_DEFINE_OUTPUT_END(IllegalPrepareConstrainedRegion)         
-    MDA_DEFINE_ASSISTANT_END(IllegalPrepareConstrainedRegion)
-
-    // InvalidApartmentStateChange
-    MDA_DEFINE_ASSISTANT(InvalidApartmentStateChange, NULL)
-        // Input
-        MDA_DEFINE_INPUT_AS_SWITCH(InvalidApartmentStateChange)
-        // Output
-        MDA_DEFINE_OUTPUT(InvalidApartmentStateChange)
-            MDA_XSD_ONCE()
-                MDA_XSD_ELEMENT_REFTYPE(Thread, ThreadType)
-            MDA_XSD_ONCE_END()
-        MDA_DEFINE_OUTPUT_END(InvalidApartmentStateChange)
-    MDA_DEFINE_ASSISTANT_END(InvalidApartmentStateChange)
-
-    // InvalidCERCall
-    MDA_DEFINE_ASSISTANT(InvalidCERCall, NULL)
-        // Input
-        MDA_DEFINE_INPUT_AS_SWITCH(InvalidCERCall)
-        // Output
-        MDA_DEFINE_OUTPUT(InvalidCERCall)
-            MDA_XSD_ONCE()
-                MDA_XSD_ELEMENT__REFTYPE(Method, MethodType)
-                MDA_XSD_ELEMENT_REFTYPE(Callsite, MethodAndOffsetType)
-            MDA_XSD_ONCE_END()
-        MDA_DEFINE_OUTPUT_END(InvalidCERCall)         
-    MDA_DEFINE_ASSISTANT_END(InvalidCERCall)
-
-    // InvalidFunctionPointerInDelegate
-    MDA_DEFINE_ASSISTANT(InvalidFunctionPointerInDelegate, NULL)
-        // Input
-        MDA_DEFINE_INPUT_AS_SWITCH(InvalidFunctionPointerInDelegate)
-        // Output
-        MDA_DEFINE_OUTPUT(InvalidFunctionPointerInDelegate)
-        MDA_DEFINE_OUTPUT_END(InvalidFunctionPointerInDelegate)      
-    MDA_DEFINE_ASSISTANT_END(InvalidFunctionPointerInDelegate)
-
-    // InvalidIUnknown
-    MDA_DEFINE_ASSISTANT(InvalidIUnknown, NULL)
-        // Input
-        MDA_DEFINE_INPUT_AS_SWITCH(InvalidIUnknown)
-        // Output
-        MDA_DEFINE_OUTPUT(InvalidIUnknown)
-        MDA_DEFINE_OUTPUT_END(InvalidIUnknown)      
-    MDA_DEFINE_ASSISTANT_END(InvalidIUnknown)
-
-    // InvalidMemberDeclaration
-    MDA_DEFINE_ASSISTANT(InvalidMemberDeclaration, NULL)
-        // Input
-        MDA_DEFINE_INPUT_AS_SWITCH(InvalidMemberDeclaration)
-        // Output
-        MDA_DEFINE_OUTPUT(InvalidMemberDeclaration)
-            MDA_XSD_ONCE()
-                MDA_XSD_CHOICE()
-                    MDA_XSD_ELEMENT__REFTYPE(Method, MethodType)
-                    MDA_XSD_ELEMENT_REFTYPE(Field, FieldType)
-                MDA_XSD_CHOICE_END()            
-                MDA_XSD_ELEMENT_REFTYPE(Type, TypeType)
-                MDA_XSD_ELEMENT__REFTYPE(Exception, ExceptionType)
-            MDA_XSD_ONCE_END()       
-        MDA_DEFINE_OUTPUT_END(InvalidMemberDeclaration)
-    MDA_DEFINE_ASSISTANT_END(InvalidMemberDeclaration)
-
-    // InvalidOverlappedToPinvoke
-    MDA_DEFINE_ASSISTANT(InvalidOverlappedToPinvoke, NULL)
-        // Input
-        MDA_DEFINE_INPUT(InvalidOverlappedToPinvoke)
-            MDA_XSD_ATTRIBUTE__DEFAULT(JustMyCode, BOOL, W("true"))
-        MDA_DEFINE_INPUT_END(InvalidOverlappedToPinvoke)
-        // Output
-        MDA_DEFINE_OUTPUT(InvalidOverlappedToPinvoke)
-        MDA_DEFINE_OUTPUT_END(InvalidOverlappedToPinvoke)
-    MDA_DEFINE_ASSISTANT_END(InvalidOverlappedToPinvoke) 
-
-    // InvalidVariant
-    MDA_DEFINE_ASSISTANT(InvalidVariant, NULL)
-        // Input
-        MDA_DEFINE_INPUT_AS_SWITCH(InvalidVariant)
-        // Output
-        MDA_DEFINE_OUTPUT(InvalidVariant)
-        MDA_DEFINE_OUTPUT_END(InvalidVariant)      
-    MDA_DEFINE_ASSISTANT_END(InvalidVariant)
-
-    // JitCompilationStart
-    MDA_DEFINE_ASSISTANT(JitCompilationStart, NULL)   
-        // Input
-        MDA_DEFINE_INPUT(JitCompilationStart)
-            MDA_XSD_OPTIONAL()
-                MDA_XSD_ELEMENT_REFTYPE(Methods, MemberFilterType)                
-            MDA_XSD_OPTIONAL_END()
-            MDA_XSD_ATTRIBUTE_DEFAULT(Break, BOOL, W("true"))
-        MDA_DEFINE_INPUT_END(JitCompilationStart)
-        // Output
-        MDA_DEFINE_OUTPUT(JitCompilationStart)
-            MDA_XSD_ONCE()
-                MDA_XSD_ELEMENT_REFTYPE(Method, MethodType)
-            MDA_XSD_ONCE_END()
-        MDA_DEFINE_OUTPUT_END(JitCompilationStart)         
-    MDA_DEFINE_ASSISTANT_END(JitCompilationStart)   
-
-    // LoaderLock
-    MDA_DEFINE_ASSISTANT(LoaderLock, NULL)
-        // Input
-        MDA_DEFINE_INPUT_AS_SWITCH(LoaderLock)
-        // Output
-        MDA_DEFINE_OUTPUT(LoaderLock)
-        MDA_DEFINE_OUTPUT_END(LoaderLock)         
-    MDA_DEFINE_ASSISTANT_END(LoaderLock)
-
-    // LoadFromContext
-    MDA_DEFINE_ASSISTANT(LoadFromContext, NULL)
-        // Input
-        MDA_DEFINE_INPUT_AS_SWITCH(LoadFromContext)
-        // Output
-        MDA_DEFINE_OUTPUT(LoadFromContext)
-            MDA_XSD_ONCE()
-                MDA_XSD__ELEMENT(AssemblyInfo)
-                    MDA_XSD_ATTRIBUTE__REQ(DisplayName, SString)
-                    MDA_XSD_ATTRIBUTE__REQ(CodeBase, SString)
-                MDA_XSD_ELEMENT_END(AssemblyInfo)
-            MDA_XSD_ONCE_END()
-        MDA_DEFINE_OUTPUT_END(LoadFromContext)         
-    MDA_DEFINE_ASSISTANT_END(LoadFromContext)
-
-    // MarshalCleanupError
-    MDA_DEFINE_ASSISTANT(MarshalCleanupError, NULL)
-        // Input
-        MDA_DEFINE_INPUT_AS_SWITCH(MarshalCleanupError)
-        // Output
-        MDA_DEFINE_OUTPUT(MarshalCleanupError)
-        MDA_DEFINE_OUTPUT_END(MarshalCleanupError)      
-    MDA_DEFINE_ASSISTANT_END(MarshalCleanupError)
-
-    // Marshaling
-    MDA_DEFINE_ASSISTANT(Marshaling, NULL)
-        // Input
-        MDA_DEFINE_INPUT(Marshaling)
-            MDA_XSD_ONCE()
-                MDA_XSD_OPTIONAL()
-                    MDA_XSD_ELEMENT_REFTYPE(MethodFilter, MemberFilterType)
-                MDA_XSD_OPTIONAL_END()
-                MDA_XSD_OPTIONAL()
-                    MDA_XSD_ELEMENT_REFTYPE(FieldFilter, MemberFilterType)
-                MDA_XSD_OPTIONAL_END()
-            MDA_XSD_ONCE_END()
-        MDA_DEFINE_INPUT_END(Marshaling)
-        // Output
-        MDA_DEFINE_OUTPUT(Marshaling)
-            MDA_XSD_CHOICE()
-                MDA_XSD_ELEMENT_REFTYPE(MarshalingParameter, ParameterType)
-                MDA_XSD_ELEMENT_REFTYPE(MarshalingField, FieldType)
-            MDA_XSD_CHOICE_END()
-        MDA_DEFINE_OUTPUT_END(Marshaling)
-    MDA_DEFINE_ASSISTANT_END(Marshaling)
-
-    // ModuloObjectHashcode
-    MDA_DEFINE_ASSISTANT(ModuloObjectHashcode, W("moh"))
-        // Input
-        MDA_DEFINE_INPUT(ModuloObjectHashcode)
-            MDA_XSD_ATTRIBUTE_DEFAULT(Modulus, INT32, W("1"))
-        MDA_DEFINE_INPUT_END(ModuloObjectHashcode)
-    MDA_DEFINE_ASSISTANT_END(ModuloObjectHashcode)
-
-    // NonComVisibleBaseClass
-    MDA_DEFINE_ASSISTANT(NonComVisibleBaseClass, NULL)
-        // Input
-        MDA_DEFINE_INPUT_AS_SWITCH(NonComVisibleBaseClass)
-        // Output
-        MDA_DEFINE_OUTPUT(NonComVisibleBaseClass)
-            MDA_XSD_ONCE()
-                MDA_XSD_ELEMENT_REFTYPE(DerivedType, TypeType)
-                MDA_XSD_ELEMENT_REFTYPE(BaseType, TypeType)
-            MDA_XSD_ONCE_END()
-        MDA_DEFINE_OUTPUT_END(NonComVisibleBaseClass)         
-    MDA_DEFINE_ASSISTANT_END(NonComVisibleBaseClass)
-
-    // NotMarshalable
-    MDA_DEFINE_ASSISTANT(NotMarshalable, NULL)
-        // Input
-        MDA_DEFINE_INPUT_AS_SWITCH(NotMarshalable)
-        // Output
-        MDA_DEFINE_OUTPUT(NotMarshalable)
-        MDA_DEFINE_OUTPUT_END(NotMarshalable)      
-    MDA_DEFINE_ASSISTANT_END(NotMarshalable)
-
-    // OpenGenericCERCall
-    MDA_DEFINE_ASSISTANT(OpenGenericCERCall, NULL)
-        // Input
-        MDA_DEFINE_INPUT_AS_SWITCH(OpenGenericCERCall)
-        // Output
-        MDA_DEFINE_OUTPUT(OpenGenericCERCall)
-            MDA_XSD_ONCE()
-                MDA_XSD_ELEMENT__REFTYPE(Method, MethodType)
-            MDA_XSD_ONCE_END()
-        MDA_DEFINE_OUTPUT_END(OpenGenericCERCall)         
-    MDA_DEFINE_ASSISTANT_END(OpenGenericCERCall)
-
-    // OverlappedFreeError
-    MDA_DEFINE_ASSISTANT(OverlappedFreeError, NULL)
-        // Input
-        MDA_DEFINE_INPUT_AS_SWITCH(OverlappedFreeError)
-        // Output
-        MDA_DEFINE_OUTPUT(OverlappedFreeError)
-        MDA_DEFINE_OUTPUT_END(OverlappedFreeError)
-    MDA_DEFINE_ASSISTANT_END(OverlappedFreeError) 
-
-    // PInvokeLog
-    MDA_DEFINE_ASSISTANT(PInvokeLog, NULL)
-        // Input
-        MDA_DEFINE_INPUT(PInvokeLog)
-            MDA_XSD_OPTIONAL()
-                MDA_XSD_ELEMENT(Filter)
-                    MDA_XSD_PERIODIC()
-                        MDA_XSD__ELEMENT(Match)
-                            MDA_XSD_ATTRIBUTE__REQ(DllName, SString)                    
-                        MDA_XSD_ELEMENT_END(Match)
-                    MDA_XSD_PERIODIC_END()
-                MDA_XSD_ELEMENT_END(Filter)
-            MDA_XSD_OPTIONAL_END()
-        MDA_DEFINE_INPUT_END(PInvokeLog)
-        // Output
-        MDA_DEFINE_OUTPUT(PInvokeLog)
-            MDA_XSD_GROUP_REF(PInvokeGrpType)
-        MDA_DEFINE_OUTPUT_END(PInvokeLog)
-    MDA_DEFINE_ASSISTANT_END(PInvokeLog) 
-
-#ifdef _TARGET_X86_ 
-    // PInvokeStackImbalance
-    MDA_DEFINE_ASSISTANT(PInvokeStackImbalance, NULL)
-        // Input
-        MDA_DEFINE_INPUT_AS_SWITCH(PInvokeStackImbalance)
-        // Output
-        MDA_DEFINE_OUTPUT(PInvokeStackImbalance)
-            MDA_XSD_ONCE()
-                MDA_XSD_ELEMENT__REFTYPE(Method, MethodType)
-            MDA_XSD_ONCE_END()
-        MDA_DEFINE_OUTPUT_END(PInvokeStackImbalance)
-    MDA_DEFINE_ASSISTANT_END(PInvokeStackImbalance) 
-#endif    
-
-    // RaceOnRCWCleanup
-    MDA_DEFINE_ASSISTANT(RaceOnRCWCleanup, NULL)
-        // Input
-        MDA_DEFINE_INPUT_AS_SWITCH(RaceOnRCWCleanup)
-        // Output
-        MDA_DEFINE_OUTPUT(RaceOnRCWCleanup)
-        MDA_DEFINE_OUTPUT_END(RaceOnRCWCleanup)      
-    MDA_DEFINE_ASSISTANT_END(RaceOnRCWCleanup)
-
-    // Reentrancy
-    MDA_DEFINE_ASSISTANT(Reentrancy, NULL)
-        // Input
-        MDA_DEFINE_INPUT_AS_SWITCH(Reentrancy)
-        // Output
-        MDA_DEFINE_OUTPUT(Reentrancy)
-        MDA_DEFINE_OUTPUT_END(Reentrancy)         
-    MDA_DEFINE_ASSISTANT_END(Reentrancy)
-
-    // ReleaseHandleFailed
-    MDA_DEFINE_ASSISTANT(ReleaseHandleFailed, NULL)
-        // Input
-        MDA_DEFINE_INPUT_AS_SWITCH(ReleaseHandleFailed)
-        // Output
-        MDA_DEFINE_OUTPUT(ReleaseHandleFailed)
-            MDA_XSD_ONCE()
-                MDA_XSD_ELEMENT__REFTYPE(Type, TypeType)
-                MDA_XSD_ELEMENT(Handle)
-                    MDA_XSD_ATTRIBUTE_REQ(Value, SString)
-                MDA_XSD_ELEMENT_END(Handle)
-            MDA_XSD_ONCE_END()
-        MDA_DEFINE_OUTPUT_END(ReleaseHandleFailed)         
-    MDA_DEFINE_ASSISTANT_END(ReleaseHandleFailed)
-
-    // ReportAvOnComRelease
-    MDA_DEFINE_ASSISTANT(ReportAvOnComRelease, NULL)
-        // Input
-        MDA_DEFINE_INPUT(ReportAvOnComRelease)
-            MDA_XSD_ATTRIBUTE_DEFAULT(AllowAv, BOOL, W("false"))
-        MDA_DEFINE_INPUT_END(ReportAvOnComRelease)
-        // Output
-        MDA_DEFINE_OUTPUT(ReportAvOnComRelease)
-        MDA_DEFINE_OUTPUT_END(ReportAvOnComRelease)
-    MDA_DEFINE_ASSISTANT_END(ReportAvOnComRelease)   
-    
-    // VirtualCERCall
-    MDA_DEFINE_ASSISTANT(VirtualCERCall, NULL)
-        // Input
-        MDA_DEFINE_INPUT_AS_SWITCH(VirtualCERCall)
-        // Output
-        MDA_DEFINE_OUTPUT(VirtualCERCall)
-            MDA_XSD_ONCE()
-                MDA_XSD_ELEMENT__REFTYPE(Method, MethodType)
-                MDA_XSD_ELEMENT__REFTYPE(Callsite, MethodAndOffsetType)
-            MDA_XSD_ONCE_END()
-        MDA_DEFINE_OUTPUT_END(VirtualCERCall)         
-    MDA_DEFINE_ASSISTANT_END(VirtualCERCall)
-
-    //
-    // Framework helper assistants
-    //
-#if _DEBUG
-    // XmlValidationError
-    MDA_DEFINE_ASSISTANT(XmlValidationError, NULL)   
-        // Input
-        MDA_DEFINE_INPUT_AS_SWITCH(XmlValidationError)
-        // Output       
-        MDA_DEFINE_OUTPUT(XmlValidationError)
-            MDA_XSD_ONCE()
-                MDA_XSD_ELEMENT(ViolatingXml)
-                MDA_XSD_ELEMENT_END(ViolatingXml)
-                MDA_XSD_ELEMENT(ViolatedXsd)
-                MDA_XSD_ELEMENT_END(ViolatedXsd)
-            MDA_XSD_ONCE_END()
-        MDA_DEFINE_OUTPUT_END(XmlValidationError)        
-    MDA_DEFINE_ASSISTANT_END(XmlValidationError)   
-#endif
-
-    // InvalidConfigFile
-    MDA_DEFINE_ASSISTANT(InvalidConfigFile, NULL)   
-        // Input
-        MDA_DEFINE_INPUT_AS_SWITCH(InvalidConfigFile)
-        // Output
-        MDA_DEFINE_OUTPUT(InvalidConfigFile)
-            MDA_XSD_ATTRIBUTE_REQ(ConfigFile, SString)
-        MDA_DEFINE_OUTPUT_END(InvalidConfigFile)        
-    MDA_DEFINE_ASSISTANT_END(InvalidConfigFile)   
-
-
-    //
-    // Framework Type and Element definitions
-    // 
-    MDA_XSD_OUTPUT_ONLY()
-    
-        // Module
-        MDA_XSD_DEFINE_TYPE(ModuleType)
-            MDA_XSD_ATTRIBUTE__OPT(Name, SString)
-        MDA_XSD_DEFINE_TYPE_END(ModuleType)
-    
-        // Type
-        MDA_XSD_DEFINE_TYPE(TypeType)
-            MDA_XSD_ATTRIBUTE__REQ(Name, SString)
-        MDA_XSD_DEFINE_TYPE_END(TypeType)
-
-        // Parameter
-        MDA_XSD_DEFINE_TYPE(ParameterType)
-            MDA_XSD_ONCE()
-                MDA_XSD_ELEMENT_REFTYPE(DeclaringMethod, MethodType)      
-            MDA_XSD_ONCE_END()
-            
-            MDA_XSD_ATTRIBUTE_OPT(Index, INT32)
-            MDA_XSD_ATTRIBUTE__OPT(Name, SString)
-        MDA_XSD_DEFINE_TYPE_END(ParameterType)
-
-        // Method
-        MDA_XSD_DEFINE_TYPE(MethodType)
-            MDA_XSD_ATTRIBUTE__REQ(Name, SString)
-        MDA_XSD_DEFINE_TYPE_END(MethodType)
-    
-        // Field
-        MDA_XSD_DEFINE_TYPE(FieldType)
-            MDA_XSD_ATTRIBUTE_REQ(Name, SString)
-        MDA_XSD_DEFINE_TYPE_END(FieldType)
-
-        // Thread
-        MDA_XSD_DEFINE_TYPE(ThreadType)
-            MDA_XSD_ATTRIBUTE_REQ(OsId, INT32)
-            MDA_XSD_ATTRIBUTE_OPT(ManagedId, INT32)
-        MDA_XSD_DEFINE_TYPE_END(ThreadType)
-
-        // Exception
-        MDA_XSD_DEFINE_TYPE(ExceptionType)
-            MDA_XSD_ONCE()
-                MDA_XSD_ELEMENT__REFTYPE(Type, TypeType)
-            MDA_XSD_ONCE_END()        
-            MDA_XSD_ATTRIBUTE_REQ(Message, SString)
-        MDA_XSD_DEFINE_TYPE_END(ExceptionType)
-
-        // MethodAndOffset
-        MDA_XSD_DEFINE_TYPE(MethodAndOffsetType)        
-            MDA_XSD_ATTRIBUTE__REQ(Name, SString)
-            MDA_XSD_ATTRIBUTE_OPT(Offset, SString)
-        MDA_XSD_DEFINE_TYPE_END(MethodAndOffsetType)
-
-        // PInvoke
-        MDA_XSD_GROUP(PInvokeGrpType)
-            MDA_XSD_ONCE()
-                MDA_XSD_ELEMENT__REFTYPE(Method, MethodType)
-                MDA_XSD_ELEMENT(DllImport)
-                    MDA_XSD_ATTRIBUTE_REQ(EntryPoint, SString)                    
-                    MDA_XSD_ATTRIBUTE_REQ(DllName, SString)
-                MDA_XSD_ELEMENT_END(DllImport)
-            MDA_XSD_ONCE_END()
-        MDA_XSD_GROUP_END(PInvokeGrpType)
-        
-    MDA_XSD_OUTPUT_ONLY_END()
-
-
-    
-    MDA_XSD_INPUT_ONLY()
-
-        // MemberFilter
-        MDA_XSD_DEFINE_TYPE(MemberFilterType)
-            MDA_XSD_PERIODIC()
-                MDA_XSD_ELEMENT(Match)
-                    MDA_XSD_ATTRIBUTE_DEFAULT(Module, SString, NULL)
-                    MDA_XSD_ATTRIBUTE__REQ(Name, SString)
-                    MDA_XSD_ATTRIBUTE__OPT(JustMyCode, BOOL)
-                MDA_XSD_ELEMENT_END(Match)
-            MDA_XSD_PERIODIC_END()
-
-            MDA_XSD_ATTRIBUTE_DEFAULT(JustMyCode, BOOL, W("true"))
-        MDA_XSD_DEFINE_TYPE_END(MemberFilterType)   
-
-
-    MDA_XSD_INPUT_ONLY_END()
-
-
-    
-
-
diff --git a/src/vm/mdagroups.inl b/src/vm/mdagroups.inl
deleted file mode 100644 (file)
index 7f4602a..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-
-//
-// Groups
-//
-
-
-// These are the MDAs that are on by-default when a debugger is attached.
-// These ABSOLUTELY MUST NOT CHANGE BEHAVIOR. They must be purely checks
-// with absolutely no sideeffects.
-// Violating this will cause an app to behave differently under a debugger
-// vs. not under a debugger, and that will really confuse end-users.
-// (eg, "My app only does XYZ when running under a debugger."
-// If you have any questions about this, please follow up with the
-// managed debugger team for further guidance.
-MDA_GROUP_DEFINITION(managedDebugger) 
-    MDA_GROUP_MEMBER(AsynchronousThreadAbort)
-    MDA_GROUP_MEMBER(BindingFailure)
-    MDA_GROUP_MEMBER(CallbackOnCollectedDelegate)
-    MDA_GROUP_MEMBER(ContextSwitchDeadlock)
-    MDA_GROUP_MEMBER(DangerousThreadingAPI)
-    MDA_GROUP_MEMBER(DisconnectedContext)
-    MDA_GROUP_MEMBER(DllMainReturnsFalse)
-    MDA_GROUP_MEMBER(ExceptionSwallowedOnCallFromCom)
-    MDA_GROUP_MEMBER(FailedQI)
-    MDA_GROUP_MEMBER(FatalExecutionEngineError)    
-    MDA_GROUP_MEMBER(InvalidApartmentStateChange)
-    MDA_GROUP_MEMBER(InvalidFunctionPointerInDelegate)
-    MDA_GROUP_MEMBER(InvalidMemberDeclaration)
-    MDA_GROUP_MEMBER(InvalidOverlappedToPinvoke)
-    MDA_GROUP_MEMBER(InvalidVariant)
-    MDA_GROUP_MEMBER(LoaderLock)
-    MDA_GROUP_MEMBER(LoadFromContext)
-    MDA_GROUP_MEMBER(MarshalCleanupError)
-    MDA_GROUP_MEMBER(NonComVisibleBaseClass)
-    MDA_GROUP_MEMBER(NotMarshalable)
-#ifdef _X86_ 
-    MDA_GROUP_MEMBER(PInvokeStackImbalance)
-#endif
-    MDA_GROUP_MEMBER(RaceOnRCWCleanup)
-    MDA_GROUP_MEMBER(Reentrancy)
-    MDA_GROUP_MEMBER(ReleaseHandleFailed)
-    MDA_GROUP_MEMBER(ReportAvOnComRelease)
-MDA_GROUP_DEFINITION_END(managedDebugger) 
-
-MDA_GROUP_DEFINITION(unmanagedDebugger) 
-    MDA_GROUP_MEMBER(Reentrancy)
-    MDA_GROUP_MEMBER(LoaderLock)
-MDA_GROUP_DEFINITION_END(unmanagedDebugger) 
-
-MDA_GROUP_DEFINITION(halting) 
-    MDA_GROUP_MEMBER(CallbackOnCollectedDelegate)
-    MDA_GROUP_MEMBER(ContextSwitchDeadlock)
-    MDA_GROUP_MEMBER(DisconnectedContext)
-    MDA_GROUP_MEMBER(FatalExecutionEngineError)    
-    MDA_GROUP_MEMBER(InvalidFunctionPointerInDelegate)
-    MDA_GROUP_MEMBER(InvalidMemberDeclaration)
-    MDA_GROUP_MEMBER(InvalidVariant)
-    MDA_GROUP_MEMBER(LoaderLock)
-    MDA_GROUP_MEMBER(NonComVisibleBaseClass)
-#ifdef _X86_ 
-    MDA_GROUP_MEMBER(PInvokeStackImbalance)
-#endif
-    MDA_GROUP_MEMBER(RaceOnRCWCleanup)
-    MDA_GROUP_MEMBER(Reentrancy)
-MDA_GROUP_DEFINITION_END(halting) 
-
diff --git a/src/vm/mdamacroscrubber.inl b/src/vm/mdamacroscrubber.inl
deleted file mode 100644 (file)
index 5091ce7..0000000
+++ /dev/null
@@ -1,295 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-#ifndef MDA_MACRO_DEFAULTS
-#define MDA_MACRO_DEFAULTS
-
-#ifndef MDA_DEFINE_ASSISTANT
-#define MDA_DEFINE_ASSISTANT(ASSISTANT, SOS) // Did you forget to define a class Mda##Assistant?
-#endif
-#ifndef MDA_DEFINE_ASSISTANT_END
-#define MDA_DEFINE_ASSISTANT_END(ASSISTANT)
-#endif
-#ifndef MDA_GFLAG_ACTIVATION
-#define MDA_GFLAG_ACTIVATION(ASSISTANT, GFLAG)
-#endif
-
-#ifndef MDA_DEFINE_INPUT
-#define MDA_DEFINE_INPUT(ASSISTANT)
-#endif
-#ifndef MDA_DEFINE_INPUT_END
-#define MDA_DEFINE_INPUT_END(ASSISTANT)
-#endif
-#ifndef MDA_DEFINE_INPUT_AS_SWITCH
-#define MDA_DEFINE_INPUT_AS_SWITCH(ASSISTANT)
-#endif
-#ifndef MDA_DEFINE_OUTPUT
-#define MDA_DEFINE_OUTPUT(ASSISTANT)
-#endif
-#ifndef MDA_DEFINE_OUTPUT_END
-#define MDA_DEFINE_OUTPUT_END(ASSISTANT)
-#endif
-
-#ifndef MDA_XSD_INPUT_ONLY
-#define MDA_XSD_INPUT_ONLY()
-#endif
-#ifndef MDA_XSD_INPUT_ONLY_END
-#define MDA_XSD_INPUT_ONLY_END()
-#endif
-#ifndef MDA_XSD_OUTPUT_ONLY
-#define MDA_XSD_OUTPUT_ONLY()
-#endif
-#ifndef MDA_XSD_OUTPUT_ONLY_END
-#define MDA_XSD_OUTPUT_ONLY_END()
-#endif
-
-#ifndef MDA_XSD_SCHEMA_SCHEMA
-#define MDA_XSD_SCHEMA_SCHEMA()
-#endif
-#ifndef MDA_XSD_SCHEMA_SCHEMA_END
-#define MDA_XSD_SCHEMA_SCHEMA_END()
-#endif
-
-#ifndef MDA_XSD_ASSISTANT_SCHEMA
-#define MDA_XSD_ASSISTANT_SCHEMA()
-#endif
-#ifndef MDA_XSD_ASSISTANT_SCHEMA_END
-#define MDA_XSD_ASSISTANT_SCHEMA_END()
-#endif
-
-#ifndef MDA_XSD_ELEMENT
-#define MDA_XSD_ELEMENT(NAME)
-#endif
-#ifndef MDA_XSD__ELEMENT
-#define MDA_XSD__ELEMENT(NAME)
-#endif
-#ifndef MDA_XSD_ELEMENT_END
-#define MDA_XSD_ELEMENT_END(NAME)
-#endif
-#ifndef MDA_XSD_ELEMENT_ANY
-#define MDA_XSD_ELEMENT_ANY(NAME)
-#endif
-#ifndef MDA_XSD_ELEMENT__ANY
-#define MDA_XSD_ELEMENT__ANY(NAME)
-#endif
-#ifndef MDA_XSD_ELEMENT_ANY_END
-#define MDA_XSD_ELEMENT_ANY_END(NAME)
-#endif
-#ifndef MDA_XSD_DEFINE_ELEMENT
-#define MDA_XSD_DEFINE_ELEMENT(NAME)
-#endif
-#ifndef MDA_XSD_DEFINE_ELEMENT_END
-#define MDA_XSD_DEFINE_ELEMENT_END(NAME)
-#endif
-
-#ifndef MDA_XSD_DEFINE_TYPE
-#define MDA_XSD_DEFINE_TYPE(NAME)
-#endif
-#ifndef MDA_XSD_DEFINE_TYPE_END
-#define MDA_XSD_DEFINE_TYPE_END(NAME)
-#endif
-#ifndef MDA_XSD_ELEMENT_REF
-#define MDA_XSD_ELEMENT_REF(NAME)
-#endif
-#ifndef MDA_XSD_TYPEDEF_ELEMENT
-#define MDA_XSD_TYPEDEF_ELEMENT(NAME, TYPE)
-#endif
-#ifndef MDA_XSD_ELEMENT_REFTYPE
-#define MDA_XSD_ELEMENT_REFTYPE(NAME, TYPE)
-#endif
-#ifndef MDA_XSD_ELEMENT__REFTYPE
-#define MDA_XSD_ELEMENT__REFTYPE(NAME, TYPE)
-#endif
-#ifndef MDA_XSD_ELEMENT_EXTEND_TYPE
-#define MDA_XSD_ELEMENT_EXTEND_TYPE(NAME, TYPE)
-#endif
-#ifndef MDA_XSD_ELEMENT_EXTEND__TYPE
-#define MDA_XSD_ELEMENT_EXTEND__TYPE(NAME, TYPE)
-#endif
-#ifndef MDA_XSD_ELEMENT_EXTEND_TYPE_END
-#define MDA_XSD_ELEMENT_EXTEND_TYPE_END(NAME, TYPE)
-#endif
-
-#ifndef MDA_XSD_DEFINE_EXTEND_ELEMENT
-#define MDA_XSD_DEFINE_EXTEND_ELEMENT(NAME, TYPE)
-#endif
-#ifndef MDA_XSD_DEFINE_EXTEND_ELEMENT_END
-#define MDA_XSD_DEFINE_EXTEND_ELEMENT_END(NAME, TYPE)
-#endif
-
-#ifndef MDA_XSD_ATTRIBUTE_OPT
-#define MDA_XSD_ATTRIBUTE_OPT(NAME,TYPE)
-#endif
-#ifndef MDA_XSD_ATTRIBUTE__OPT
-#define MDA_XSD_ATTRIBUTE__OPT(NAME,TYPE)
-#endif
-#ifndef MDA_XSD_ATTRIBUTE_REQ
-#define MDA_XSD_ATTRIBUTE_REQ(NAME,TYPE)
-#endif
-#ifndef MDA_XSD_ATTRIBUTE__REQ
-#define MDA_XSD_ATTRIBUTE__REQ(NAME,TYPE)
-#endif
-#ifndef MDA_XSD_ATTRIBUTE_DEFAULT
-#define MDA_XSD_ATTRIBUTE_DEFAULT(NAME,TYPE,DEFAULT)
-#endif
-#ifndef MDA_XSD_ATTRIBUTE__DEFAULT
-#define MDA_XSD_ATTRIBUTE__DEFAULT(NAME,TYPE,DEFAULT)
-#endif
-#ifndef MDA_XSD_DEFINE_ATTRIBUTE
-#define MDA_XSD_DEFINE_ATTRIBUTE(NAME,TYPE)
-#endif
-
-
-#ifndef MDA_XSD_COMPLEX_TYPE
-#define MDA_XSD_COMPLEX_TYPE()
-#endif
-#ifndef MDA_XSD_COMPLEX_TYPE_END
-#define MDA_XSD_COMPLEX_TYPE_END()
-#endif
-
-#ifndef MDA_XSD_ONCE
-#define MDA_XSD_ONCE()
-#endif
-#ifndef MDA_XSD_ONCE_END
-#define MDA_XSD_ONCE_END()
-#endif
-#ifndef MDA_XSD_OPTIONAL
-#define MDA_XSD_OPTIONAL()
-#endif
-#ifndef MDA_XSD_OPTIONAL_END
-#define MDA_XSD_OPTIONAL_END()
-#endif
-#ifndef MDA_XSD_PERIODIC
-#define MDA_XSD_PERIODIC()
-#endif
-#ifndef MDA_XSD_PERIODIC_END
-#define MDA_XSD_PERIODIC_END()
-#endif
-
-#ifndef MDA_XSD_GROUP
-#define MDA_XSD_GROUP(NAME)
-#endif
-#ifndef MDA_XSD_GROUP_END
-#define MDA_XSD_GROUP_END(NAME)
-#endif
-#ifndef MDA_XSD_GROUP_REF
-#define MDA_XSD_GROUP_REF(NAME)
-#endif
-
-#ifndef MDA_XSD_DEFINE_EXTEND_TYPE
-#define MDA_XSD_DEFINE_EXTEND_TYPE(NAME, TYPE)
-#endif
-#ifndef MDA_XSD_DEFINE_EXTEND_TYPE_END
-#define MDA_XSD_DEFINE_EXTEND_TYPE_END(NAME, TYPE)
-#endif
-
-#ifndef MDA_XSD_EXTENSION
-#define MDA_XSD_EXTENSION()
-#endif
-#ifndef MDA_XSD_EXTENSION_END
-#define MDA_XSD_EXTENSION_END()
-#endif
-
-#ifndef MDA_XSD_CHOICE
-#define MDA_XSD_CHOICE()
-#endif
-#ifndef MDA_XSD_CHOICE_END
-#define MDA_XSD_CHOICE_END()
-#endif
-
-#ifndef MDA_GROUP_DEFINITION
-#define MDA_GROUP_DEFINITION(NAME)
-#endif
-#ifndef MDA_GROUP_DEFINITION_END
-#define MDA_GROUP_DEFINITION_END(NAME)
-#endif
-#ifndef MDA_GROUP_MEMBER
-#define MDA_GROUP_MEMBER(NAME)
-#endif
-
-
-
-#else 
-#undef MDA_MACRO_DEFAULTS
-
-#undef MDA_DEFINE_SCHEMA
-#undef MDA_XSD_ASSISTANT_SCHEMA
-#undef MDA_XSD_ASSISTANT_SCHEMA_END
-#undef MDA_XSD_SCHEMA_SCHEMA
-#undef MDA_XSD_SCHEMA_SCHEMA_END
-
-#undef MDA_DEFINE_ASSISTANT
-#undef MDA_DEFINE_ASSISTANT_END
-#undef MDA_GFLAG_ACTIVATION
-
-#undef MDA_DEFINE_INPUT
-#undef MDA_DEFINE_INPUT_END
-#undef MDA_DEFINE_INPUT_AS_SWITCH
-#undef MDA_DEFINE_OUTPUT
-#undef MDA_DEFINE_OUTPUT_END
-
-#undef MDA_XSD_INPUT_ONLY
-#undef MDA_XSD_INPUT_ONLY_END
-#undef MDA_XSD_OUTPUT_ONLY
-#undef MDA_XSD_OUTPUT_ONLY_END
-
-#undef MDA_XSD_ELEMENT
-#undef MDA_XSD__ELEMENT
-#undef MDA_XSD_ELEMENT_ANY
-#undef MDA_XSD_ELEMENT__ANY
-#undef MDA_XSD_ELEMENT_ANY_END
-#undef MDA_XSD_ELEMENT_END
-#undef MDA_XSD_DEFINE_ELEMENT
-#undef MDA_XSD_DEFINE_ELEMENT_END
-
-#undef MDA_XSD_DEFINE_TYPE
-#undef MDA_XSD_DEFINE_TYPE_END
-#undef MDA_XSD_ELEMENT_REF
-#undef MDA_XSD_TYPEDEF_ELEMENT
-#undef MDA_XSD_ELEMENT_REFTYPE
-#undef MDA_XSD_ELEMENT__REFTYPE
-#undef MDA_XSD_ELEMENT_EXTEND_TYPE
-#undef MDA_XSD_ELEMENT_EXTEND__TYPE
-#undef MDA_XSD_ELEMENT_EXTEND_TYPE_END
-
-#undef MDA_XSD_DEFINE_EXTEND_ELEMENT
-#undef MDA_XSD_DEFINE_EXTEND_ELEMENT_END
-
-#undef MDA_XSD_ATTRIBUTE_OPT
-#undef MDA_XSD_ATTRIBUTE__OPT
-#undef MDA_XSD_ATTRIBUTE_REQ
-#undef MDA_XSD_ATTRIBUTE__REQ
-#undef MDA_XSD_ATTRIBUTE_DEFAULT
-#undef MDA_XSD_ATTRIBUTE__DEFAULT
-#undef MDA_XSD_DEFINE_ATTRIBUTE
-
-
-#undef MDA_XSD_COMPLEX_TYPE
-#undef MDA_XSD_COMPLEX_TYPE_END
-
-#undef MDA_XSD_ONCE
-#undef MDA_XSD_ONCE_END
-#undef MDA_XSD_OPTIONAL
-#undef MDA_XSD_OPTIONAL_END
-#undef MDA_XSD_PERIODIC
-#undef MDA_XSD_PERIODIC_END
-
-#undef MDA_XSD_GROUP
-#undef MDA_XSD_GROUP_END
-#undef MDA_XSD_GROUP_REF
-
-#undef MDA_XSD_DEFINE_EXTEND_TYPE
-#undef MDA_XSD_DEFINE_EXTEND_TYPE_END
-#undef MDA_XSD_EXTENSION
-#undef MDA_XSD_EXTENSION_END
-
-#undef MDA_XSD_CHOICE
-#undef MDA_XSD_CHOICE_END
-
-#undef MDA_GROUP_DEFINITION
-#undef MDA_GROUP_DEFINITION_END
-#undef MDA_GROUP_MEMBER
-
-
-#endif
diff --git a/src/vm/mdaschema.inl b/src/vm/mdaschema.inl
deleted file mode 100644 (file)
index 201c850..0000000
+++ /dev/null
@@ -1,575 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-
-//
-// MDA_DEFINE_ASSISTANT_ENUMERATION
-//
-#ifdef MDA_DEFINE_ASSISTANT_ENUMERATION
-#define MDA_DEFINE_ASSISTANT(NAME, ABBR) MdaElemDef(NAME),
-#endif
-
-//
-// MDA_ASSISTANT_NAME
-//
-#ifdef MDA_ASSISTANT_NAME
-#define MDA_DEFINE_ASSISTANT(NAME, ABBR) L#NAME,
-#endif
-
-//
-// MDA_ASSISTANT_ABBR
-//
-#ifdef MDA_ASSISTANT_ABBR
-#define MDA_DEFINE_ASSISTANT(NAME, ABBR) ABBR,
-#endif
-
-//
-// MDA_ELEMENT_DEFINITION_STRING
-//
-#ifdef MDA_ASSISTANT_STRING
-#define MDA_DEFINE_ASSISTANT(NAME, ABBR) L#NAME
-#endif
-
-//
-// MDA_ASSISTANT_HEAP_RAW
-//
-#ifdef MDA_ASSISTANT_HEAP_RAW
-#define MDA_DEFINE_ASSISTANT(NAME, ABBR) Mda##NAME m_mda##NAME;   
-#endif
-
-//
-// MDA_ASSISTANT_STATIC_INIT
-//
-#ifdef MDA_ASSISTANT_STATIC_INIT
-#define MDA_DEFINE_ASSISTANT(NAME, ABBR)                                        \
-    {                                                                           \
-        MdaElemDef(NAME),       /* m_assistantDeclDef */                        \
-        MdaElemDef(NAME##Msg),  /* m_assistantMsgDeclDef */                     \
-        0                       /* m_bSuppressDialog */                         \
-    },                                                                          
-#endif 
-
-#ifdef MDA_VALIDATE_MEMBER_LAYOUT
-// See MDA_ASSISTANT_BASE_MEMBERS for details on why we're asserting that these fields have matching offsets.
-#define MDA_DEFINE_ASSISTANT(NAME, ABBR) \
-    static_assert_no_msg(offsetof(MdaAssistant, m_assistantDeclDef)     == offsetof(Mda##NAME, m_assistantDeclDef));    \
-    static_assert_no_msg(offsetof(MdaAssistant, m_assistantMsgDeclDef)  == offsetof(Mda##NAME, m_assistantMsgDeclDef)); \
-    static_assert_no_msg(offsetof(MdaAssistant, m_bSuppressDialog)      == offsetof(Mda##NAME, m_bSuppressDialog));     
-#endif
-
-//
-// MDA_ASSISTANT_IS_SWITCH
-//
-#ifdef MDA_ASSISTANT_IS_SWITCH
-#define MDA_DEFINE_INPUT_AS_SWITCH(ASSISTANT) true,                            
-#define MDA_DEFINE_INPUT(ASSISTANT) false,                                     
-#endif
-
-//
-// MDA_DEFINE_GROUPS
-//
-#ifdef MDA_DEFINE_GROUPS
-#define MDA_GROUP_DEFINITION(NAME)                                                      \
-    pGroup = arrayFactory.Create();                                                     \
-    aGroups.Append(pGroup);    
-#define MDA_GROUP_MEMBER(NAME) pGroup->Append(MdaElemDef(NAME));
-#endif
-
-//
-// MDA_ACTIVATE_GROUPS
-//
-#ifdef MDA_ACTIVATE_GROUPS
-#define MDA_GROUP_DEFINITION(NAME)                                                      \
-    if (sszActivationMechanism.EqualsCaseInsensitive(L#NAME))                           \
-        ActivateGroup(L#NAME, aGroups[cGroup], &mdaXmlPairs);                           \
-    cGroup++;
-#endif
-
-//
-// MDA_ACTIVATE_SINGLTON_GROUPS
-//
-#ifdef MDA_ACTIVATE_SINGLTON_GROUPS
-#define MDA_DEFINE_ASSISTANT(NAME, ABBR)                                        \
-    if (sszActivationMechanism.EqualsCaseInsensitive(L#NAME))                           \
-        mdaXmlPairs.Set(ToLowerFirstChar(L#NAME, &sstringFactory),                      \
-            GetSwitchActivationXml(MdaElemDef(NAME)));
-#endif
-
-//
-// MDA_ELEMENT_DEFINITION_ENUMERATION
-//
-#ifdef MDA_ELEMENT_DEFINITION_ENUMERATION
-#define MDA_XSD_DEFINE_ELEMENT(NAME) MdaElemDef(NAME),
-#define MDA_XSD_TYPEDEF_ELEMENT(NAME, TYPE) MDA_XSD_DEFINE_ELEMENT(NAME)
-#define MDA_XSD_DEFINE_EXTEND_ELEMENT(NAME, TYPE)  MDA_XSD_DEFINE_ELEMENT(NAME)
-#define MDA_XSD_DEFINE_EXTEND_TYPE(NAME, TYPE)  MDA_XSD_DEFINE_ELEMENT(NAME)
-#define MDA_XSD_GROUP(NAME) MDA_XSD_DEFINE_ELEMENT(NAME)
-#define MDA_XSD_DEFINE_TYPE(NAME) MDA_XSD_DEFINE_ELEMENT(NAME)
-#define MDA_DEFINE_ASSISTANT(NAME, ABBR) MDA_XSD_DEFINE_ELEMENT(NAME##Msg)
-MDA_XSD_DEFINE_ELEMENT(AssistantConfigGroup)
-MDA_XSD_DEFINE_ELEMENT(AssistantMsgGroup)
-#endif
-
-//
-// MDA_ELEMENT_DECLARAION_ENUMERATION
-//
-#ifdef MDA_ELEMENT_DECLARAION_ENUMERATION
-#define MDA_XSD_ELEMENT(NAME) MdaElemDecl(NAME),
-#define MDA_XSD_ELEMENT_REFTYPE(NAME, TYPE) MDA_XSD_ELEMENT(NAME)
-#define MDA_XSD_ELEMENT_EXTEND_TYPE(NAME, TYPE) MDA_XSD_ELEMENT(NAME)
-#define MDA_XSD_ELEMENT_ANY(NAME) MDA_XSD_ELEMENT(NAME)
-#endif
-
-//
-// MDA_ATTRIBUTE_DECLARATION_ENUMERATION
-//
-#ifdef MDA_ATTRIBUTE_DECLARATION_ENUMERATION
-#define MDA_XSD_ATTRIBUTE_OPT(NAME, TYPE) MdaAttrDecl(NAME),
-#define MDA_XSD_ATTRIBUTE_REQ(NAME, TYPE) MDA_XSD_ATTRIBUTE_OPT(NAME, TYPE)
-#define MDA_XSD_ATTRIBUTE_DEFAULT(NAME, TYPE, DEFAULT) MDA_XSD_ATTRIBUTE_OPT(NAME, TYPE)
-#endif
-
-//
-// MDA_MAP_ASSISTANT_DEFINITION_TO_NAME
-//
-#ifdef MDA_MAP_ASSISTANT_DEFINITION_TO_NAME
-#define MDA_DEFINE_ASSISTANT(NAME, ABBR) g_arElementNames[i++] = ToLowerFirstChar(L#NAME);
-#endif
-
-//
-// MDA_MAP_ELEMENT_DEFINITION_TO_NAME
-//
-#ifdef MDA_MAP_ELEMENT_DEFINITION_TO_NAME
-#define MDA_XSD_DEFINE_ELEMENT(NAME) g_arElementNames[i++] = ToLowerFirstChar(L#NAME);
-#define MDA_XSD_TYPEDEF_ELEMENT(NAME, TYPE) MDA_XSD_DEFINE_ELEMENT(NAME)
-#define MDA_XSD_DEFINE_EXTEND_ELEMENT(NAME, TYPE)  MDA_XSD_DEFINE_ELEMENT(NAME)
-#define MDA_XSD_DEFINE_EXTEND_TYPE(NAME, TYPE)  MDA_XSD_DEFINE_ELEMENT(NAME)
-#define MDA_XSD_GROUP(NAME) MDA_XSD_DEFINE_ELEMENT(NAME)
-#define MDA_XSD_DEFINE_TYPE(NAME) MDA_XSD_DEFINE_ELEMENT(NAME)
-#define MDA_DEFINE_ASSISTANT(NAME, ABBR) MDA_XSD_DEFINE_ELEMENT(NAME##Msg)
-MDA_XSD_DEFINE_ELEMENT(AssistantConfigGroup)
-MDA_XSD_DEFINE_ELEMENT(AssistantMsgGroup)
-#endif
-
-//
-// MDA_MAP_ELEMENT_DECLARATION_TO_NAME
-//
-#ifdef MDA_MAP_ELEMENT_DECLARATION_TO_NAME
-#define MDA_XSD_ELEMENT(NAME) g_arElementNames[i++] = ToLowerFirstChar(L#NAME);
-#define MDA_XSD_ELEMENT_REFTYPE(NAME, TYPE) MDA_XSD_ELEMENT(NAME)
-#define MDA_XSD_ELEMENT_EXTEND_TYPE(NAME, TYPE) MDA_XSD_ELEMENT(NAME)
-#define MDA_XSD_ELEMENT_ANY(NAME) MDA_XSD_ELEMENT(NAME)
-#endif
-
-//
-// MDA_MAP_ATTRIBUTE_DECLARATION_TO_NAME
-//
-#ifdef MDA_MAP_ATTRIBUTE_DECLARATION_TO_NAME
-#define MDA_XSD_ATTRIBUTE_OPT(NAME, TYPE) g_arAttributeNames[i++] = ToLowerFirstChar(L#NAME);
-#define MDA_XSD_ATTRIBUTE_REQ(NAME, TYPE) MDA_XSD_ATTRIBUTE_OPT(NAME, TYPE)
-#define MDA_XSD_ATTRIBUTE_DEFAULT(NAME, TYPE, DEFAULT) MDA_XSD_ATTRIBUTE_OPT(NAME, TYPE)
-#endif
-
-//
-// MDA_MAP_ELEMENT_NAME_TO_DEFINITION
-//
-#ifdef MDA_MAP_ASSISTANT_NAME_TO_DEFINITION
-#define MDA_DEFINE_ASSISTANT(NAME, ABBR) g_pHtElementType->Set(g_arElementNames[MdaElemDef(NAME)], MdaElemDef(NAME));
-#endif
-
-//
-// MDA_MAP_ELEMENT_NAME_TO_DEFINITION
-//
-#ifdef MDA_MAP_ELEMENT_NAME_TO_DEFINITION
-#define MDA_XSD_DEFINE_ELEMENT(NAME) g_pHtElementType->Set(g_arElementNames[MdaElemDef(NAME)], MdaElemDef(NAME));
-#define MDA_XSD_TYPEDEF_ELEMENT(NAME, TYPE) MDA_XSD_DEFINE_ELEMENT(NAME)
-#define MDA_XSD_DEFINE_EXTEND_ELEMENT(NAME, TYPE)  MDA_XSD_DEFINE_ELEMENT(NAME)
-#define MDA_XSD_DEFINE_EXTEND_TYPE(NAME, TYPE)  MDA_XSD_DEFINE_ELEMENT(NAME)
-#define MDA_XSD_GROUP(NAME) MDA_XSD_DEFINE_ELEMENT(NAME)
-#define MDA_XSD_DEFINE_TYPE(NAME) MDA_XSD_DEFINE_ELEMENT(NAME)
-#define MDA_DEFINE_ASSISTANT(NAME, ABBR) MDA_XSD_DEFINE_ELEMENT(NAME##Msg)
-MDA_XSD_DEFINE_ELEMENT(AssistantConfigGroup)
-MDA_XSD_DEFINE_ELEMENT(AssistantMsgGroup)
-#endif
-
-//
-// MDA_MAP_ELEMENT_NAME_TO_DECLARATION
-//
-#ifdef MDA_MAP_ELEMENT_NAME_TO_DECLARATION
-#define MDA_XSD_ELEMENT(NAME) g_pHtElementType->Set(g_arElementNames[MdaElemDecl(NAME)], MdaElemDecl(NAME));
-#define MDA_XSD_ELEMENT_REFTYPE(NAME, TYPE) MDA_XSD_ELEMENT(NAME)
-#define MDA_XSD_ELEMENT_EXTEND_TYPE(NAME, TYPE) MDA_XSD_ELEMENT(NAME)
-#define MDA_XSD_ELEMENT_ANY(NAME) MDA_XSD_ELEMENT(NAME)
-#endif
-
-//
-// MDA_MAP_ATTRIBUTE_NAME_TO_DECLARATION
-//
-#ifdef MDA_MAP_ATTRIBUTE_NAME_TO_DECLARATION
-#define MDA_XSD_ATTRIBUTE_OPT(NAME, TYPE) g_pHtAttributeType->Set(g_arAttributeNames[MdaAttrDecl(NAME)], MdaAttrDecl(NAME));
-#define MDA_XSD_ATTRIBUTE_REQ(NAME, TYPE) MDA_XSD_ATTRIBUTE_OPT(NAME, TYPE)
-#define MDA_XSD_ATTRIBUTE_DEFAULT(NAME, TYPE, DEFAULT) MDA_XSD_ATTRIBUTE_OPT(NAME, TYPE)
-#endif
-
-//
-// MDA_ASSISTANT_CREATION
-//
-#ifdef MDA_ASSISTANT_CREATION
-#define MDA_DEFINE_ASSISTANT(ASSISTANT, ABBR)                                                   \
-    if (mdaXmlPairs.Get(MdaSchema::g_arElementNames[MdaElemDef(ASSISTANT)], &pXmlAssistant))    \
-    {                                                                                           \
-        if (MdaAssistant::IsAssistantActive(pXmlAssistant))                                     \
-        {                                                                                       \
-            Mda##ASSISTANT* pAssistant = &g_mdaStaticHeap.m_mda##ASSISTANT;                     \
-            pAssistant->AsMdaAssistant()->Initialize(pXmlAssistant);                            \
-            pAssistant->Initialize(pXmlAssistant);                                              \
-            g_mdaStaticHeap.m_assistants[MdaElemDef(ASSISTANT)] = pAssistant->AsMdaAssistant(); \
-        }                                                                                       \
-    }
-#endif
-
-
-//
-// MDA_DEFINE_SCHEMA_SCHEMA
-//
-#ifdef MDA_DEFINE_SCHEMA_SCHEMA
-#define MDA_DEFINE_SCHEMA
-#define MDA_XSD_ASSISTANT_SCHEMA() if (FALSE) {
-#define MDA_XSD_ASSISTANT_SCHEMA_END() }
-#define MDA_XSD_SCHEMA_SCHEMA() DefineSchema();
-#define MDA_XSD_SCHEMA_SCHEMA_END() DefineSchemaEnd();
-#endif
-
-//
-// MDA_DEFINE_ASSISTANT_SCHEMA
-//
-#ifdef MDA_DEFINE_ASSISTANT_SCHEMA
-#define MDA_DEFINE_SCHEMA
-#define MDA_XSD_SCHEMA_SCHEMA() if (FALSE) {
-#define MDA_XSD_SCHEMA_SCHEMA_END() }
-#define MDA_XSD_OUTPUT_ONLY() if (FALSE) {
-#define MDA_XSD_OUTPUT_ONLY_END() }
-#define MDA_DEFINE_INPUT(ASSISTANT) DefineAssistantInput(MdaElemDef(ASSISTANT));
-#define MDA_DEFINE_INPUT_END(ASSISTANT) DefineAssistantInputEnd(MdaElemDef(ASSISTANT));
-#define MDA_DEFINE_OUTPUT(ASSISTANT) if (FALSE) {
-#define MDA_DEFINE_OUTPUT_END(ASSISTANT) }
-#define MDA_XSD_ASSISTANT_SCHEMA() DefineSchema();
-#endif
-
-//
-// MDA_DEFINE_MDA_ASSISTANT_CONFIG_GROUP
-//
-#ifdef MDA_DEFINE_MDA_ASSISTANT_CONFIG_GROUP
-#define MDA_XSD_ASSISTANT_SCHEMA() AddGroup(MdaElemDef(AssistantConfigGroup)); AddSequence(0, 1);
-#define MDA_XSD_ASSISTANT_SCHEMA_END()  AddSequenceEnd(); AddGroupEnd(MdaElemDef(AssistantConfigGroup));
-#define MDA_DEFINE_INPUT(ASSISTANT) AddSequence(0, 1); RefElement(MdaElemDef(ASSISTANT)); AddSequenceEnd();                              
-#endif
-
-//
-// MDA_DEFINE_ASSISTANT_MSG_SCHEMA
-//
-#ifdef MDA_DEFINE_ASSISTANT_MSG_SCHEMA
-#define MDA_DEFINE_SCHEMA
-#define MDA_XSD_SCHEMA_SCHEMA() if (FALSE) {
-#define MDA_XSD_SCHEMA_SCHEMA_END() }
-#define MDA_XSD_INPUT_ONLY() if (FALSE) {
-#define MDA_XSD_INPUT_ONLY_END() }
-#define MDA_DEFINE_INPUT(ASSISTANT) if (FALSE) {
-#define MDA_DEFINE_INPUT_END(ASSISTANT) }
-#define MDA_DEFINE_OUTPUT(ASSISTANT) DefineAssistantOutput(MdaElemDef(ASSISTANT), MdaElemDef(ASSISTANT##Msg));
-#define MDA_DEFINE_OUTPUT_END(ASSISTANT) DefineAssistantOutputEnd(MdaElemDef(ASSISTANT), MdaElemDef(ASSISTANT##Msg));
-#define MDA_XSD_ASSISTANT_SCHEMA() DefineSchema();
-#endif
-
-//
-// MDA_DEFINE_MDA_ASSISTANT_MSG_GROUP
-//
-#ifdef MDA_DEFINE_MDA_ASSISTANT_MSG_GROUP
-#define MDA_XSD_ASSISTANT_SCHEMA() AddGroup(MdaElemDef(AssistantMsgGroup)); AddSequence(0, 1);
-#define MDA_XSD_ASSISTANT_SCHEMA_END()  AddSequenceEnd(); AddGroupEnd(MdaElemDef(AssistantMsgGroup)); DefineSchemaEnd();
-#define MDA_DEFINE_OUTPUT(ASSISTANT) RefElement(MdaElemDef(ASSISTANT##Msg));
-#endif
-
-//
-// MDA_DEFINE_SCHEMA
-//
-#ifdef MDA_DEFINE_SCHEMA
-
-// Assistants
-#define MDA_DEFINE_ASSISTANT(NAME, ABBR) DefineAssistant(MdaElemDef(NAME));
-#define MDA_DEFINE_ASSISTANT_END(NAME) DefineAssistantEnd(MdaElemDef(NAME));
-
-// Attributes
-#define MDA_XSD_ATTRIBUTE_OPT(NAME,TYPE) AddAttribute(MdaAttrDecl(NAME), MdaSchemaPrimitive##TYPE, FALSE, NULL);
-#define MDA_XSD_ATTRIBUTE__OPT(NAME,TYPE) AddAttribute(MdaAttrDecl(NAME), MdaSchemaPrimitive##TYPE, FALSE, NULL);
-#define MDA_XSD_ATTRIBUTE_REQ(NAME,TYPE) AddAttribute(MdaAttrDecl(NAME), MdaSchemaPrimitive##TYPE, TRUE, NULL);
-#define MDA_XSD_ATTRIBUTE__REQ(NAME,TYPE) AddAttribute(MdaAttrDecl(NAME), MdaSchemaPrimitive##TYPE, TRUE, NULL);
-#define MDA_XSD_ATTRIBUTE_DEFAULT(NAME,TYPE,DEFAULT) AddAttribute(MdaAttrDecl(NAME), MdaSchemaPrimitive##TYPE, FALSE, DEFAULT);
-#define MDA_XSD_ATTRIBUTE__DEFAULT(NAME,TYPE,DEFAULT) AddAttribute(MdaAttrDecl(NAME), MdaSchemaPrimitive##TYPE, FALSE, DEFAULT);
-
-// Definitions
-#define MDA_XSD_DEFINE_ELEMENT(NAME)  AddElement(MdaElemDef(NAME));
-#define MDA_XSD_DEFINE_ELEMENT_END(NAME) AddElementEnd(MdaElemDef(NAME));
-#define MDA_XSD_DEFINE_TYPE(NAME) AddComplexType(MdaElemDef(NAME));
-#define MDA_XSD_DEFINE_TYPE_END(NAME) AddComplexTypeEnd(MdaElemDef(NAME));
-#define MDA_XSD_DEFINE_EXTEND_TYPE(NAME, TYPE) AddExtendType(MdaElemDef(NAME), MdaElemDef(TYPE));
-#define MDA_XSD_DEFINE_EXTEND_TYPE_END(NAME, TYPE) AddExtendTypeEnd(MdaElemDef(NAME), MdaElemDef(TYPE));
-#define MDA_XSD_DEFINE_EXTEND_ELEMENT(NAME, TYPE) AddExtendElement(MdaElemDef(NAME), MdaElemDef(TYPE));
-#define MDA_XSD_DEFINE_EXTEND_ELEMENT_END(NAME, TYPE) AddExtendElementEnd(MdaElemDef(NAME), MdaElemDef(TYPE));
-#define MDA_XSD_TYPEDEF_ELEMENT(NAME, TYPE) AddElementRefType(MdaElemDef(NAME), MdaElemDef(TYPE));
-
-// Declarations
-#define MDA_XSD_ELEMENT(NAME) AddElement(MdaElemDecl(NAME));
-#define MDA_XSD__ELEMENT(NAME) AddElement(MdaElemDecl(NAME));
-#define MDA_XSD_ELEMENT_END(NAME) AddElementEnd(MdaElemDecl(NAME));
-#define MDA_XSD_ELEMENT_ANY(NAME) AddElementAny(MdaElemDecl(NAME));
-#define MDA_XSD_ELEMENT__ANY(NAME) AddElementAny(MdaElemDecl(NAME));
-#define MDA_XSD_ELEMENT_REF(NAME) RefElement(MdaElemDef(NAME));
-#define MDA_XSD_ELEMENT_REFTYPE(NAME, TYPE) AddElementRefType(MdaElemDecl(NAME), MdaElemDef(TYPE));
-#define MDA_XSD_ELEMENT__REFTYPE(NAME, TYPE) AddElementRefType(MdaElemDecl(NAME), MdaElemDef(TYPE));
-#define MDA_XSD_ELEMENT_EXTEND_TYPE(NAME, TYPE) AddExtendElement(MdaElemDecl(NAME), MdaElemDef(TYPE));
-#define MDA_XSD_ELEMENT_EXTEND__TYPE(NAME, TYPE) AddExtendElement(MdaElemDecl(NAME), MdaElemDef(TYPE));
-#define MDA_XSD_ELEMENT_EXTEND_TYPE_END(NAME, TYPE) AddExtendElementEnd(MdaElemDecl(NAME), MdaElemDef(TYPE));
-
-// Patterns
-#define MDA_XSD_CHOICE() AddChoice();
-#define MDA_XSD_CHOICE_END() AddChoiceEnd();
-#define MDA_XSD_GROUP(NAME) AddGroup(MdaElemDef(NAME));
-#define MDA_XSD_GROUP_END(NAME) AddGroupEnd(MdaElemDef(NAME));
-#define MDA_XSD_GROUP_REF(NAME) RefGroup(MdaElemDef(NAME));
-#define MDA_XSD_ONCE() AddSequence(1, 1);
-#define MDA_XSD_ONCE_END() AddSequenceEnd();
-#define MDA_XSD_OPTIONAL() AddSequence(0, 1);
-#define MDA_XSD_OPTIONAL_END() AddSequenceEnd();
-#define MDA_XSD_PERIODIC() AddSequence(0, -1);
-#define MDA_XSD_PERIODIC_END() AddSequenceEnd();
-#endif
-
-#ifndef MDA_DEFINE_INPUT_AS_SWITCH
-#ifdef MDA_DEFINE_INPUT
-#define MDA_DEFINE_INPUT_AS_SWITCH(ASSISTANT) MDA_DEFINE_INPUT(ASSISTANT) MDA_DEFINE_INPUT_END(ASSISTANT) 
-#endif
-#endif
-
-#include "mdamacroscrubber.inl"
-
-#include "mdagroups.inl"
-
-//
-// Standard Element Definitions
-//
-MDA_XSD_ASSISTANT_SCHEMA()
-
-
-#include "mdaassistantschemas.inl"
-
-    //
-    // MDA Output Framework Defintions
-    //
-    MDA_XSD_OUTPUT_ONLY()
-        
-        // MdaAssistantMsgGroup
-        // MDA_XSD_GROUP(AssistantMsgGroup)
-        // MDA_XSD_GROUP_END(AssistantMsgGroup)
-
-        // Output Root
-        MDA_XSD_DEFINE_TYPE(Msg)
-            MDA_XSD_GROUP_REF(AssistantMsgGroup)
-        MDA_XSD_DEFINE_TYPE_END(Msg)   
-        
-        // Output Root
-        MDA_XSD_DEFINE_TYPE(AssistantMsgType)
-            //MDA_XSD_ATTRIBUTE_REQ(Documentation, SString)
-        MDA_XSD_DEFINE_TYPE_END(AssistantMsgType)   
-        
-    MDA_XSD_OUTPUT_ONLY_END()
-
-
-
-    //
-    // MDA Input Framework Defintions
-    //
-    MDA_XSD_INPUT_ONLY()
-        
-        // MdaAssistantConfigGroup
-        // MDA_XSD_GROUP(AssistantConfigGroup)
-        // MDA_XSD_GROUP_END(AssistantConfigGroup)
-
-        // MdaConfigType
-        MDA_XSD_DEFINE_TYPE(MdaConfigType) 
-            MDA_XSD_ONCE()
-                MDA_XSD_OPTIONAL()
-                    MDA_XSD_ELEMENT(Assistants)
-                        MDA_XSD_GROUP_REF(AssistantConfigGroup)
-                    MDA_XSD_ELEMENT_END(Assistants)
-                MDA_XSD_OPTIONAL_END()  
-            MDA_XSD_ONCE_END()
-        MDA_XSD_DEFINE_TYPE_END(MdaConfigType)  
-
-        // AppConfig 
-        MDA_XSD_DEFINE_EXTEND_ELEMENT(MdaAppConfig, MdaConfigType)    
-        MDA_XSD_DEFINE_EXTEND_ELEMENT_END(MdaAppConfig, MdaConfigType)    
-
-        // MdaConfig 
-        MDA_XSD_DEFINE_EXTEND_ELEMENT(MdaConfig, MdaConfigType)    
-        MDA_XSD_DEFINE_EXTEND_ELEMENT_END(MdaConfig, MdaConfigType)    
-        
-        // MdaGroupConfig
-        MDA_XSD_DEFINE_ELEMENT(MdaGroupConfig)   
-            MDA_XSD_PERIODIC()
-                MDA_XSD_ELEMENT(Group)
-                    MDA_XSD_ONCE()
-                        MDA_XSD_PERIODIC()
-                            MDA_XSD_ELEMENT(GroupReference)
-                                MDA_XSD_ATTRIBUTE__REQ(Name, SString)
-                            MDA_XSD_ELEMENT_END(GroupReference)                            
-                        MDA_XSD_PERIODIC_END()                       
-                        MDA_XSD_OPTIONAL()
-                            MDA_XSD_GROUP_REF(AssistantConfigGroup)
-                        MDA_XSD_OPTIONAL_END()                          
-                    MDA_XSD_ONCE_END()
-                    MDA_XSD_ATTRIBUTE__REQ(Name, SString)
-                MDA_XSD_ELEMENT_END(Group)
-            MDA_XSD_PERIODIC_END()
-        MDA_XSD_DEFINE_ELEMENT_END(MdaGroupConfig)
-
-        // Mda Assistant
-        MDA_XSD_DEFINE_TYPE(Assistant)
-            MDA_XSD_ATTRIBUTE_DEFAULT(Enable, BOOL, W("true"))
-        MDA_XSD_DEFINE_TYPE_END(Assistant)
-
-        // Dummy
-        MDA_XSD_DEFINE_ELEMENT(Dummy) 
-            MDA_XSD_ATTRIBUTE_OPT(SuppressDialog, BOOL)
-        MDA_XSD_DEFINE_ELEMENT_END(Dummy) 
-        
-    MDA_XSD_INPUT_ONLY_END()
-    
-
-MDA_XSD_ASSISTANT_SCHEMA_END()
-
-
-//
-// Schema Infrastructure 
-//
-MDA_XSD_SCHEMA_SCHEMA()
-
-    // Schema Schema Definition
-    MDA_XSD_DEFINE_ELEMENT(Schema)
-        MDA_XSD_PERIODIC()
-            MDA_XSD_CHOICE()
-                MDA_XSD_ELEMENT_REF(ComplexType)               
-                MDA_XSD_ELEMENT_REF(Group)               
-                MDA_XSD_ELEMENT_REF(Element)        
-            MDA_XSD_CHOICE_END()
-        MDA_XSD_PERIODIC_END()
-        MDA_XSD_ATTRIBUTE_OPT(TargetNamespace, SString)
-        MDA_XSD_ATTRIBUTE_OPT(Xmlns, SString)
-    MDA_XSD_DEFINE_ELEMENT_END(Schema)
-
-    // Element
-    MDA_XSD_DEFINE_ELEMENT(Element)
-        MDA_XSD_OPTIONAL()                                            
-            MDA_XSD_ELEMENT_REF(ComplexType)
-        MDA_XSD_OPTIONAL_END()
-        
-        MDA_XSD_ATTRIBUTE__OPT(Name, SString)
-        MDA_XSD_ATTRIBUTE__OPT(Ref, SString)
-        MDA_XSD_ATTRIBUTE__OPT(Type, SString)
-    MDA_XSD_DEFINE_ELEMENT_END(Element)
-                
-    // ComplexType
-    MDA_XSD_DEFINE_ELEMENT(ComplexType)                  
-        MDA_XSD_OPTIONAL()   
-            MDA_XSD_CHOICE()
-                MDA_XSD_GROUP_REF(ElementContent)
-                MDA_XSD_ELEMENT_REF(ComplexContent)
-            MDA_XSD_CHOICE_END()
-        MDA_XSD_OPTIONAL_END()      
-        
-        MDA_XSD_ATTRIBUTE__OPT(Name, SString)
-    MDA_XSD_DEFINE_ELEMENT_END(ComplexType)
-    
-    // ComplexContent
-    MDA_XSD_DEFINE_ELEMENT(ComplexContent)
-        MDA_XSD_ONCE()
-            MDA_XSD_ELEMENT_REF(Extension)
-        MDA_XSD_ONCE_END()
-    MDA_XSD_DEFINE_ELEMENT_END(ComplexContent)
-
-    // Extension
-    MDA_XSD_DEFINE_ELEMENT(Extension)                                
-        MDA_XSD_GROUP_REF(ElementContent) 
-        
-        MDA_XSD_ATTRIBUTE_REQ(Base, SString)
-    MDA_XSD_DEFINE_ELEMENT_END(Extension)
-
-    // ElementContent
-    MDA_XSD_GROUP(ElementContent)
-        MDA_XSD_OPTIONAL()   
-            MDA_XSD_GROUP_REF(PatternRoot)
-            
-            MDA_XSD_PERIODIC()
-                MDA_XSD_ELEMENT_REF(Attribute)               
-            MDA_XSD_PERIODIC_END()                        
-        MDA_XSD_OPTIONAL_END()              
-    MDA_XSD_GROUP_END(ElementContent)
-
-    // PatternRoot
-    MDA_XSD_GROUP(PatternRoot)
-        MDA_XSD_OPTIONAL()
-            MDA_XSD_CHOICE()
-                MDA_XSD_ELEMENT_REF(Choice)
-                MDA_XSD_ELEMENT_REF(Sequence)
-                MDA_XSD_ELEMENT_REF(Group)
-            MDA_XSD_CHOICE_END()
-        MDA_XSD_OPTIONAL_END()
-    MDA_XSD_GROUP_END(PatternRoot)
-
-    // PeriodicPattern
-    MDA_XSD_GROUP(PeriodicPattern)
-        MDA_XSD_PERIODIC()
-            MDA_XSD_CHOICE()
-                MDA_XSD_ELEMENT_REF(Element)
-                MDA_XSD_ELEMENT_REF(Choice)
-                MDA_XSD_ELEMENT_REF(Sequence)
-                MDA_XSD_ELEMENT_REF(Group)
-            MDA_XSD_CHOICE_END()
-        MDA_XSD_PERIODIC_END()
-    MDA_XSD_GROUP_END(PeriodicPattern)
-
-    // Sequence
-    MDA_XSD_DEFINE_ELEMENT(Sequence)                        
-        MDA_XSD_GROUP_REF(PeriodicPattern)
-        
-        MDA_XSD_ATTRIBUTE_OPT(MinOccurs, SString)
-        MDA_XSD_ATTRIBUTE_OPT(MaxOccurs, SString)
-    MDA_XSD_DEFINE_ELEMENT_END(Sequence)
-
-    // Choice
-    MDA_XSD_DEFINE_ELEMENT(Choice)
-        MDA_XSD_GROUP_REF(PeriodicPattern)                                    
-    MDA_XSD_DEFINE_ELEMENT_END(Choice)
-    
-    // Group
-    MDA_XSD_DEFINE_ELEMENT(Group)
-        MDA_XSD_GROUP_REF(PatternRoot)    
-        
-        MDA_XSD_ATTRIBUTE__OPT(Name, SString)
-        MDA_XSD_ATTRIBUTE_OPT(Ref, SString)
-    MDA_XSD_DEFINE_ELEMENT_END(Group)
-
-    // Attribute
-    MDA_XSD_DEFINE_ELEMENT(Attribute)
-        MDA_XSD_ATTRIBUTE__REQ(Name, SString)
-        MDA_XSD_ATTRIBUTE_REQ(Type, SString)
-        MDA_XSD_ATTRIBUTE_OPT(Use, SString)
-        MDA_XSD_ATTRIBUTE_OPT(Default, SString)
-    MDA_XSD_DEFINE_ELEMENT_END(Attribute)                
-    
-MDA_XSD_SCHEMA_SCHEMA_END()       
-
-#include "mdamacroscrubber.inl"
-
index 096dcc4..68626c7 100644 (file)
@@ -3028,10 +3028,6 @@ public:
 private:
     FARPROC FindEntryPointWithMangling(HINSTANCE mod, PTR_CUTF8 entryPointName) const;
 
-#ifdef MDA_SUPPORTED    
-    Stub* GenerateStubForMDA(LPVOID pNativeTarget, Stub *pInnerStub);
-#endif // MDA_SUPPORTED
-
 public:
 
     void SetStackArgumentSize(WORD cbDstBuffer, CorPinvokeMap unmgdCallConv)
index b2e7a07..609eda0 100644 (file)
@@ -19,7 +19,6 @@
 #include "dllimport.h"
 #include "fieldmarshaler.h"
 #include "encee.h"
-#include "mdaassistants.h"
 #include "ecmakey.h"
 #include "customattribute.h"
 #include "typestring.h"
index 5a01340..c4696bc 100644 (file)
@@ -15,7 +15,6 @@
 #include "eeconfig.h"
 #include "eehash.h"
 #include "../dlls/mscorrc/resource.h"
-#include "mdaassistants.h"
 #include "typeparse.h"
 #include "comdelegate.h"
 #include "olevariant.h"
index 10ed494..e206c13 100644 (file)
 #include "comdependenthandle.h"
 #include "weakreferencenative.h"
 #include "varargsnative.h"
-
-#ifdef MDA_SUPPORTED 
-#include "mdaassistants.h"
-#endif
+#include "mlinfo.h"
 
 #ifdef FEATURE_COMINTEROP
 #include "variant.h"
index 4585f8d..50188f0 100644 (file)
@@ -968,19 +968,11 @@ DEFINE_METHOD(STUBHELPERS,          GET_COM_IP_FROM_RCW_WINRT,                Ge
 DEFINE_METHOD(STUBHELPERS,          GET_COM_IP_FROM_RCW_WINRT_SHARED_GENERIC, GetCOMIPFromRCW_WinRTSharedGeneric, SM_Obj_IntPtr_RefIntPtr_RetIntPtr)
 DEFINE_METHOD(STUBHELPERS,          GET_COM_IP_FROM_RCW_WINRT_DELEGATE,       GetCOMIPFromRCW_WinRTDelegate,      SM_Obj_IntPtr_RefIntPtr_RetIntPtr)
 DEFINE_METHOD(STUBHELPERS,          SHOULD_CALL_WINRT_INTERFACE,              ShouldCallWinRTInterface,           SM_Obj_IntPtr_RetBool)
-DEFINE_METHOD(STUBHELPERS,          STUB_REGISTER_RCW,                        StubRegisterRCW,                    SM_Obj_RetVoid)
-DEFINE_METHOD(STUBHELPERS,          STUB_UNREGISTER_RCW,                      StubUnregisterRCW,                  SM_Obj_RetVoid)
 DEFINE_METHOD(STUBHELPERS,          GET_WINRT_FACTORY_OBJECT,                 GetWinRTFactoryObject,              SM_IntPtr_RetObj)
 DEFINE_METHOD(STUBHELPERS,          GET_DELEGATE_INVOKE_METHOD,               GetDelegateInvokeMethod,            SM_Delegate_RetIntPtr)
 DEFINE_METHOD(STUBHELPERS,          GET_WINRT_FACTORY_RETURN_VALUE,           GetWinRTFactoryReturnValue,         SM_Obj_IntPtr_RetIntPtr)
 DEFINE_METHOD(STUBHELPERS,          GET_OUTER_INSPECTABLE,                    GetOuterInspectable,                SM_Obj_IntPtr_RetIntPtr)
-#ifdef MDA_SUPPORTED
-DEFINE_METHOD(STUBHELPERS,          TRIGGER_EXCEPTION_SWALLOWED_MDA,          TriggerExceptionSwallowedMDA,       SM_Exception_IntPtr_RetException)
-#endif // MDA_SUPPORTED
 #endif // FEATURE_COMINTEROP
-#if defined(MDA_SUPPORTED)
-DEFINE_METHOD(STUBHELPERS,          CHECK_COLLECTED_DELEGATE_MDA, CheckCollectedDelegateMDA, SM_IntPtr_RetVoid)
-#endif // MDA_SUPPORTED
 DEFINE_METHOD(STUBHELPERS,          SET_LAST_ERROR,         SetLastError,               SM_RetVoid)
 DEFINE_METHOD(STUBHELPERS,          CLEAR_LAST_ERROR,       ClearLastError,             SM_RetVoid)
 
@@ -1007,9 +999,6 @@ DEFINE_METHOD(STUBHELPERS,          LOG_PINNED_ARGUMENT,                LogPinne
 #ifdef _TARGET_64BIT_
 DEFINE_METHOD(STUBHELPERS,          GET_STUB_CONTEXT_ADDR,              GetStubContextAddr,             SM_RetIntPtr)
 #endif // _TARGET_64BIT_
-#ifdef MDA_SUPPORTED
-DEFINE_METHOD(STUBHELPERS,          TRIGGER_GC_FOR_MDA,                 TriggerGCForMDA,                SM_RetVoid)
-#endif
 DEFINE_METHOD(STUBHELPERS,          SAFE_HANDLE_ADD_REF,    SafeHandleAddRef,           SM_SafeHandle_RefBool_RetIntPtr)
 DEFINE_METHOD(STUBHELPERS,          SAFE_HANDLE_RELEASE,    SafeHandleRelease,          SM_SafeHandle_RetVoid)
 
index 13e3218..a01f71e 100644 (file)
@@ -17,7 +17,6 @@
 #include "nativeoverlapped.h"
 #include "corhost.h"
 #include "win32threadpool.h"
-#include "mdaassistants.h"
 #include "comsynchronizable.h"
 #include "comthreadpool.h"
 #include "marshalnative.h"
index b6e7fbb..2fa2f11 100644 (file)
 #include "comcache.h"
 
 #include "notifyexternals.h"
-#include "mdaassistants.h"
 
 // On some platforms, we can detect whether the current thread holds the loader
 // lock.  It is unsafe to execute managed code when this is the case
-BOOL ShouldCheckLoaderLock(BOOL fForMDA /*= TRUE*/)
+BOOL ShouldCheckLoaderLock()
 {
     CONTRACTL
     {
@@ -37,24 +36,13 @@ BOOL ShouldCheckLoaderLock(BOOL fForMDA /*= TRUE*/)
     // 0 here.  Any explicit initialization will result in thread-safety problems.
     static BOOL fInited;
     static BOOL fShouldCheck;
-    static BOOL fShouldCheck_ForMDA;
 
     if (VolatileLoad(&fInited) == FALSE)
     {
-        fShouldCheck_ForMDA = FALSE;
-
         fShouldCheck = AuxUlibInitialize();      // may fail
 
-#ifdef MDA_SUPPORTED
-        if (fShouldCheck)
-        {
-            MdaLoaderLock* pProbe = MDA_GET_ASSISTANT(LoaderLock);
-            if (pProbe)
-                fShouldCheck_ForMDA = TRUE;
-        }
-#endif // MDA_SUPPORTED
         VolatileStore(&fInited, TRUE);
     }
-    return (fForMDA ? fShouldCheck_ForMDA : fShouldCheck);
+    return (fShouldCheck);
 #endif // FEATURE_CORESYSTEM
 }
index 1241cde..4888d70 100644 (file)
@@ -17,7 +17,6 @@
 #include "olevariant.h"
 #include "comdatetime.h"
 #include "fieldmarshaler.h"
-#include "mdaassistants.h"
 
 /* ------------------------------------------------------------------------- *
  * Local constants
@@ -3050,12 +3049,6 @@ void OleVariant::MarshalObjectForOleVariant(const VARIANT * pOle, OBJECTREF * co
         COMPlusThrow(kPlatformNotSupportedException, IDS_EE_BADMARSHAL_TYPE_VARIANTASOBJECT);
     }
 
-#ifdef MDA_SUPPORTED
-    MdaInvalidVariant* pProbe = MDA_GET_ASSISTANT(InvalidVariant);
-    if (pProbe && !CheckVariant((VARIANT*)pOle))
-        pProbe->ReportViolation();
-#endif
-
     // if V_ISBYREF(pOle) and V_BYREF(pOle) is null then we have a problem,
     // unless we're dealing with VT_EMPTY or VT_NULL in which case that is ok??
     VARTYPE vt = V_VT(pOle) & ~VT_BYREF;
index aaab4c6..1d99f43 100644 (file)
@@ -36,8 +36,6 @@
 #include "clrtocomcall.h"
 #endif
 
-#include "mdaassistants.h"
-
 #ifdef FEATURE_STACK_SAMPLING
 #include "stacksampler.h"
 #endif
@@ -740,12 +738,6 @@ PCODE MethodDesc::JitCompileCodeLockedEventWrapper(PrepareCodeConfig* pConfig, J
     ULONG sizeOfCode = 0;
     CORJIT_FLAGS flags;
 
-#ifdef MDA_SUPPORTED 
-    MdaJitCompilationStart* pProbe = MDA_GET_ASSISTANT(JitCompilationStart);
-    if (pProbe)
-        pProbe->NowCompiling(this);
-#endif // MDA_SUPPORTED
-
 #ifdef PROFILING_SUPPORTED 
     {
         BEGIN_PIN_PROFILER(CORProfilerTrackJITInfo());
index 26c2a5c..1a83a38 100644 (file)
@@ -35,7 +35,6 @@ class Object;
 #include "notifyexternals.h"
 #include "winrttypenameconverter.h"
 #include "../md/compiler/custattr.h"
-#include "mdaassistants.h"
 #include "olevariant.h"
 #include "interopconverter.h"
 #include "typestring.h"
@@ -2564,41 +2563,6 @@ INT32 RCW::ExternalRelease(OBJECTREF* pObjPROTECTED)
     // do cleanup after releasing the lock
     if (fCleanupWrapper)
     {
-#ifdef MDA_SUPPORTED
-        MdaRaceOnRCWCleanup* mda = MDA_GET_ASSISTANT(RaceOnRCWCleanup);
-        if (mda)
-        {
-            BOOL fIsInUse = FALSE;
-            
-            // Walk the thread tables, looking for this RCW in use.
-            {
-                // Take the threadstore lock
-                ThreadStoreLockHolder tslh;
-            
-                Thread* pThread = NULL;
-            
-                // walk each thread's table
-                while (NULL != (pThread = ThreadStore::GetThreadList(pThread)) )
-                {
-                    if (pThread->RCWIsInUse(pRCW))
-                    {
-                        // found a match!
-                        fIsInUse = TRUE;
-                        break;
-                    }
-                }
-            }
-            
-            // If we found one, bail.
-            if (fIsInUse)
-            {
-                // Cannot decrement the counter if it's in use.
-                ++(pRCW->m_cbRefCount);
-                mda->ReportViolation();
-            }
-        }
-#endif // MDA_SUPPORTED
-        
         // Release all the data associated with the __ComObject.
         ComObject::ReleaseAllData(pRCW->GetExposedObject());
 
@@ -2650,41 +2614,6 @@ void RCW::FinalExternalRelease(OBJECTREF* pObjPROTECTED)
     // do cleanup after releasing the lock
     if (fCleanupWrapper)
     {
-#ifdef MDA_SUPPORTED
-        MdaRaceOnRCWCleanup* mda = MDA_GET_ASSISTANT(RaceOnRCWCleanup);
-        if (mda)
-        {
-            BOOL fIsInUse = FALSE;
-            
-            // Walk the thread tables, looking for this RCW in use.
-            {
-                // Take the threadstore lock
-                ThreadStoreLockHolder tslh;
-            
-                Thread* pThread = NULL;
-            
-                // walk each thread's table
-                while (NULL != (pThread = ThreadStore::GetThreadList(pThread)) )
-                {
-                    if (pThread->RCWIsInUse(pRCW))
-                    {
-                        // found a match!
-                        fIsInUse = TRUE;
-                        break;
-                    }
-                }
-            }
-            
-            // If we found one, bail.
-            if (fIsInUse)
-            {
-                // Cannot zero the counter if it's in use.
-                pRCW->m_cbRefCount = 1;
-                mda->ReportViolation();
-            }
-        }
-#endif // MDA_SUPPORTED
-
         // Release all the data associated with the __ComObject.
         ComObject::ReleaseAllData(pRCW->GetExposedObject());
 
@@ -4034,13 +3963,6 @@ IUnknown* RCW::GetComIPForMethodTableFromCache(MethodTable* pMT)
         }
     }
 
-#ifdef MDA_SUPPORTED
-    if (FAILED(hr))
-    {
-        MDA_TRIGGER_ASSISTANT(FailedQI, ReportAdditionalInfo(hr, this, iid, pMT));
-    }
-#endif
-    
     if (pUnk == NULL)
         RETURN NULL;
 
@@ -4286,10 +4208,6 @@ HRESULT __stdcall RCW::ReleaseAllInterfacesCallBack(LPVOID pData)
             // a pointer to them directly. It will however fail for others since we only
             // have a pointer to a proxy which is no longer attached to the object.
 
-#ifdef MDA_SUPPORTED
-            MDA_TRIGGER_ASSISTANT(DisconnectedContext, ReportViolationCleanup(pWrap->GetWrapperCtxCookie(), pCurrentCtxCookie, hr));     
-#endif
-
             pWrap->ReleaseAllInterfaces();
         }
     }
@@ -4333,10 +4251,6 @@ HRESULT __stdcall RCW::ReleaseAllInterfacesCallBack(LPVOID pData)
                         // a pointer to them directly. It will however fail for others since we only
                         // have a pointer to a proxy which is no longer attached to the object.
 
-#ifdef MDA_SUPPORTED
-                        MDA_TRIGGER_ASSISTANT(DisconnectedContext, ReportViolationCleanup(it.GetCtxCookie(), pCurrentCtxCookie, hr));     
-#endif
-
                         // make sure we never try to clean this up again
                         pEntry->Free();
                         SafeReleasePreemp(pUnk, pWrap);
index 6154a32..c21117c 100644 (file)
@@ -67,7 +67,6 @@
 #include "excep.h"
 #include "comcache.h"
 #include "threads.h"
-#include "mdaassistants.h"
 #include "comcache.h"
 #include "jupiterobject.h"
 
@@ -1563,9 +1562,6 @@ public:
         m_pSB = NULL;
         m_fValid = FALSE;
         m_fRCWInUse = FALSE;
-#ifdef MDA_SUPPORTED
-        m_pMDA = MDA_GET_ASSISTANT(RaceOnRCWCleanup);
-#endif // MDA_SUPPORTED
     }
 
     ~RCWHolder()
@@ -1579,15 +1575,6 @@ public:
         }
         CONTRACTL_END;
 
-#ifdef MDA_SUPPORTED
-        // Unregister this RCW on the thread
-        if (m_pThread && m_pSB && m_fValid)
-        {
-            if (m_pMDA)
-                m_pThread->UnregisterRCW(INDEBUG(m_pSB));
-        }
-#endif // MDA_SUPPORTED
-
         if (m_fRCWInUse)
         {
             m_pRCW->DecrementUseCount();
@@ -1617,13 +1604,6 @@ public:
         }
         m_fRCWInUse = TRUE;
 
-#ifdef MDA_SUPPORTED
-        if (m_pMDA)
-        {
-            m_pThread->RegisterRCW(m_pRCW);
-        }
-#endif // MDA_SUPPORTED
-
         m_fValid = TRUE;
     }
 
@@ -1665,13 +1645,6 @@ public:
             COMPlusThrow(kInvalidComObjectException, IDS_EE_COM_OBJECT_NO_LONGER_HAS_WRAPPER);
         }
 
-#ifdef MDA_SUPPORTED
-        if (m_pMDA)
-        {
-            m_pThread->RegisterRCW(m_pRCW);
-        }
-#endif // MDA_SUPPORTED
-
         m_fValid = TRUE;
     }
 
@@ -1692,17 +1665,7 @@ public:
         
         m_pSB = pSB;
         m_pRCW = m_pSB->GetInteropInfoNoCreate()->GetRawRCW();
-
-#ifdef MDA_SUPPORTED
-        if (m_pMDA)
-        {
-            m_fValid = m_pThread->RegisterRCWNoThrow(m_pRCW);
-        }
-        else
-#endif // MDA_SUPPORTED
-        {
-            m_fValid = TRUE;
-        }
+        m_fValid = TRUE;
     }
 
     void InitNoCheck(OBJECTREF pObject)
@@ -1762,11 +1725,6 @@ public:
         if (m_fValid)
         {
             m_fValid = FALSE;
-
-#ifdef MDA_SUPPORTED
-            if (m_pMDA)
-                m_pThread->UnregisterRCW(INDEBUG(m_pSB));
-#endif // MDA_SUPPORTED
         }
 
         BOOL fThrowException = FALSE;
@@ -1832,11 +1790,6 @@ private:
     // Used for de-registration
     BOOL        m_fValid;
     BOOL        m_fRCWInUse;
-
-#ifdef MDA_SUPPORTED
-    // Stores the MDA.
-    MdaRaceOnRCWCleanup* m_pMDA;
-#endif // MDA_SUPPORTED
 };
 #endif // !DACCESS_COMPILE
 
index 2e766e7..06fdf6c 100644 (file)
@@ -20,7 +20,6 @@
 #include "excep.h"
 #include "frames.h"
 #include "eecontract.h"
-#include "mdaassistants.h"
 #include "typestring.h"
 
 WORD SafeHandle::s_IsInvalidHandleMethodSlot = MethodTable::NO_SLOT;
@@ -229,11 +228,7 @@ FCIMPL1(void, CriticalHandle::FireCustomerDebugProbe, CriticalHandle* refThisUNS
 
     HELPER_METHOD_FRAME_BEGIN_1(ch);
 
-#ifdef MDA_SUPPORTED
-    MDA_TRIGGER_ASSISTANT(ReleaseHandleFailed, ReportViolation(ch->GetTypeHandle(), ch->m_handle));
-#else
     FCUnique(0x53);
-#endif
 
     HELPER_METHOD_FRAME_END();
 }
index 3ac0d5e..c5f3d88 100644 (file)
@@ -456,10 +456,6 @@ HRESULT __stdcall ICCW_Unpeg_Wrapper(IUnknown *pUnk);
 
 
 
-#ifdef MDA_SUPPORTED
-VOID __stdcall DirtyCast_Assert(IUnknown* pUnk);
-#endif
-
 // IUNKNOWN wrappers
 
 // prototypes IUnknown methods
index 429fef9..a835ba0 100644 (file)
@@ -476,19 +476,6 @@ struct AddRefReleaseArgs
     HRESULT* hr;
 };
 
-#ifdef MDA_SUPPORTED
-VOID __stdcall DirtyCast_Assert(IUnknown* pUnk)
-{
-    WRAPPER_NO_CONTRACT;
-    
-    _ASSERTE(!"The native code calling into the CLR has performed an illegal dirty cast on this IUnknown or IDispatch pointer. "
-              "The caller neglected to QI for the correct interface before making this call.  This is not a CLR bug. "
-              "A bug should be filed against the native caller.");
-
-    MDA_TRIGGER_ASSISTANT(DirtyCastAndCallOnInterface, ReportViolation(pUnk));
-}
-#endif
-
 ULONG __stdcall Unknown_AddRef(IUnknown* pUnk)
 {
     // Ensure the Thread is available for contracts and other users of the Thread, but don't do any of
@@ -643,8 +630,6 @@ HRESULT __stdcall Unknown_QueryInterface_IErrorInfo(IUnknown* pUnk, REFIID riid,
 
         if (hr == E_NOINTERFACE)
         {
-            // make sure that the MDA fires
-            VERIFY(!CanRunManagedCode(LoaderLockCheck::ForMDA));
             hr = HOST_E_CLRNOTAVAILABLE;
         }
     }
index 9cd2cf9..2ca71db 100644 (file)
@@ -992,24 +992,6 @@ FCIMPL2(IInspectable *, StubHelpers::GetOuterInspectable, Object *pThisUNSAFE, M
 }
 FCIMPLEND
 
-#ifdef MDA_SUPPORTED
-FCIMPL2(ExceptionObject*, StubHelpers::TriggerExceptionSwallowedMDA, ExceptionObject* pExceptionUNSAFE, PCODE pManagedTarget)
-{
-    FCALL_CONTRACT;
-    OBJECTREF pException = ObjectToOBJECTREF(pExceptionUNSAFE);
-    HELPER_METHOD_FRAME_BEGIN_RET_1(pException);
-
-    // COM-to-CLR stubs use the target method entry point as their stub context
-    MethodDesc * pMD = Entry2MethodDesc(pManagedTarget, NULL);
-
-    MDA_TRIGGER_ASSISTANT(ExceptionSwallowedOnCallFromCom, ReportViolation(pMD, &pException));
-
-    HELPER_METHOD_FRAME_END();
-    return (ExceptionObject*)OBJECTREFToObject(pException);
-}
-FCIMPLEND
-#endif // MDA_SUPPORTED
-
 #endif // FEATURE_COMINTEROP
 
 FCIMPL0(void, StubHelpers::SetLastError)
@@ -1151,81 +1133,6 @@ FCIMPL2(void, StubHelpers::ThrowInteropParamException, UINT resID, UINT paramIdx
 FCIMPLEND
 
 #ifdef FEATURE_COMINTEROP
-FCIMPL1(void, StubHelpers::StubRegisterRCW, Object *unsafe_pThis)
-{
-    FCALL_CONTRACT;
-
-    OBJECTREF oref = ObjectToOBJECTREF(unsafe_pThis);
-    HELPER_METHOD_FRAME_BEGIN_1(oref);
-
-#if defined(_DEBUG) && defined(FEATURE_MDA)
-    // Make sure that we only get here because the MDA is turned on.
-    MdaRaceOnRCWCleanup* mda = MDA_GET_ASSISTANT(RaceOnRCWCleanup);
-    _ASSERTE(mda != NULL);
-#endif // _DEBUG
-
-    // RegisterRCW may throw OOM in which case we need to decrement the refcount on the RCW
-    class RCWDecrementUseCountHolder
-    {
-    public:
-        RCW *m_pRCW;
-
-        RCWDecrementUseCountHolder(RCW *pRCW)
-        {
-            LIMITED_METHOD_CONTRACT;
-            m_pRCW = pRCW;
-        }
-
-        ~RCWDecrementUseCountHolder()
-        {
-            WRAPPER_NO_CONTRACT;
-            if (m_pRCW != NULL)
-            {
-                m_pRCW->DecrementUseCount();
-            }
-        }
-    };
-
-    RCWDecrementUseCountHolder holder(oref->GetSyncBlock()->GetInteropInfoNoCreate()->GetRCWAndIncrementUseCount());
-    if (holder.m_pRCW == NULL)
-    {
-        COMPlusThrow(kInvalidComObjectException, IDS_EE_COM_OBJECT_NO_LONGER_HAS_WRAPPER);
-    }
-
-    GET_THREAD()->RegisterRCW(holder.m_pRCW);
-
-    // if we made it here, suppress the DecrementUseCount call
-    holder.m_pRCW = NULL;
-
-    HELPER_METHOD_FRAME_END();
-}
-FCIMPLEND
-
-FCIMPL1(void, StubHelpers::StubUnregisterRCW, Object *unsafe_pThis)
-{
-    FCALL_CONTRACT;
-
-    OBJECTREF oref = ObjectToOBJECTREF(unsafe_pThis);
-    HELPER_METHOD_FRAME_BEGIN_1(oref);
-
-#if defined(_DEBUG) && defined(FEATURE_MDA)
-    // Make sure that we only get here because the MDA is turned on.
-    MdaRaceOnRCWCleanup* mda = MDA_GET_ASSISTANT(RaceOnRCWCleanup);
-    _ASSERTE(mda != NULL);
-#endif // _DEBUG
-
-    RCW *pRCW = GET_THREAD()->UnregisterRCW(INDEBUG(oref->GetSyncBlock()));
-
-    if (pRCW != NULL)
-    {
-        // Thread::RegisterRCW incremented the use count, decrement it now
-        pRCW->DecrementUseCount();
-    }
-
-    HELPER_METHOD_FRAME_END();
-}
-FCIMPLEND
-
 class COMInterfaceMarshalerCallback : public ICOMInterfaceMarshalerCallback
 {
 public :
@@ -1418,36 +1325,6 @@ FCIMPLEND
 
 #endif
 
-#ifdef MDA_SUPPORTED
-NOINLINE static void CheckCollectedDelegateMDAHelper(UMEntryThunk *pEntryThunk)
-{
-    FC_INNER_PROLOG(StubHelpers::CheckCollectedDelegateMDA);
-    HELPER_METHOD_FRAME_BEGIN_ATTRIB(Frame::FRAME_ATTR_EXACT_DEPTH|Frame::FRAME_ATTR_CAPTURE_DEPTH_2);
-
-    CallbackOnCollectedDelegateHelper(pEntryThunk);
-
-    HELPER_METHOD_FRAME_END();
-    FC_INNER_EPILOG();
-}
-
-FCIMPL1(void, StubHelpers::CheckCollectedDelegateMDA, LPVOID pEntryThunk)
-{
-    CONTRACTL
-    {
-        FCALL_CHECK;
-        PRECONDITION(pEntryThunk != NULL);
-    }
-    CONTRACTL_END;
-
-    if (MDA_GET_ASSISTANT(CallbackOnCollectedDelegate) == NULL)
-        return;
-
-    // keep this FCall as fast as possible for the "MDA is off" case
-    FC_INNER_RETURN_VOID(CheckCollectedDelegateMDAHelper((UMEntryThunk *)pEntryThunk));
-}
-FCIMPLEND
-#endif // MDA_SUPPORTED
-
 #ifdef PROFILING_SUPPORTED
 FCIMPL3(SIZE_T, StubHelpers::ProfilerBeginTransitionCallback, SIZE_T pSecretParam, Thread* pThread, Object* unsafe_pThis)
 {
@@ -1847,18 +1724,6 @@ FCIMPL0(void*, StubHelpers::GetStubContextAddr)
 FCIMPLEND
 #endif // _TARGET_64BIT_
 
-#ifdef MDA_SUPPORTED    
-FCIMPL0(void, StubHelpers::TriggerGCForMDA)
-{
-    FCALL_CONTRACT;
-
-    HELPER_METHOD_FRAME_BEGIN_0();
-    TriggerGCForMDAInternal();    
-    HELPER_METHOD_FRAME_END();
-}
-FCIMPLEND
-#endif // MDA_SUPPORTED
-
 FCIMPL1(DWORD, StubHelpers::CalcVaListSize, VARARGS *varargs)
 {
     FCALL_CONTRACT;
index 50ea8d3..ae22858 100644 (file)
@@ -77,9 +77,6 @@ public:
     static FCDECL1(MethodDesc *,    GetDelegateInvokeMethod, DelegateObject *pThisUNSAFE);
     static FCDECL2(IInspectable *,  GetWinRTFactoryReturnValue, Object *pThisUNSAFE, PCODE pCtorEntry);
     static FCDECL2(IInspectable *,  GetOuterInspectable, Object *pThisUNSAFE, MethodDesc *pCtorMD);
-#ifdef MDA_SUPPORTED
-    static FCDECL2(ExceptionObject*,TriggerExceptionSwallowedMDA, ExceptionObject* pExceptionUNSAFE, PCODE pManagedTarget);
-#endif // MDA_SUPPORTED
 #endif // FEATURE_COMINTEROP
 
     static FCDECL0(void,            SetLastError            );
@@ -115,19 +112,9 @@ public:
     static FCDECL3(void,            ValidateByref, void *pByref, MethodDesc *pMD, Object *pThisUNSAFE);
 
 #ifdef FEATURE_COMINTEROP
-    //-------------------------------------------------------
-    // Helper for the MDA RaceOnRCWCleanup
-    //-------------------------------------------------------
-    static FCDECL1(void,            StubRegisterRCW,        Object *unsafe_pThis);
-    static FCDECL1(void,            StubUnregisterRCW,      Object *unsafe_pThis);
     static FCDECL1(Object*,         GetWinRTFactoryObject,  MethodDesc *pCMD);    
 #endif // FEATURE_COMINTEROP
 
-#ifdef MDA_SUPPORTED
-    static FCDECL0(void,            TriggerGCForMDA);    
-    static FCDECL1(void,            CheckCollectedDelegateMDA, LPVOID pEntryThunk);
-#endif // MDA_SUPPORTED
-
 #ifdef PROFILING_SUPPORTED
     //-------------------------------------------------------
     // Profiler helper
index 06be462..daadda8 100644 (file)
@@ -35,7 +35,6 @@
 
 #include "nativeoverlapped.h"
 
-#include "mdaassistants.h"
 #include "appdomain.inl"
 #include "vmholder.h"
 #include "exceptmacros.h"
@@ -4772,11 +4771,7 @@ Thread::ApartmentState Thread::GetApartment()
         as = TS_TO_AS(maskedTs);
     }
 
-    if (
-#ifdef MDA_SUPPORTED
-        (NULL == MDA_GET_ASSISTANT(InvalidApartmentStateChange)) &&
-#endif
-        (as != AS_Unknown))
+    if (as != AS_Unknown)
     {
         return as;
     }
@@ -4799,33 +4794,6 @@ Thread::ApartmentState Thread::GetApartmentRare(Thread::ApartmentState as)
         THDTYPE type;
         HRESULT hr = S_OK;
 
-#ifdef MDA_SUPPORTED
-        MdaInvalidApartmentStateChange* pProbe = MDA_GET_ASSISTANT(InvalidApartmentStateChange);
-        if (pProbe)
-        {
-            // Without notifications from OLE32, we cannot know when the apartment state of a
-            // thread changes.  But we have cached this fact and depend on it for all our
-            // blocking and COM Interop behavior to work correctly.  Using the CDH, log that it
-            // is not changing underneath us, on those platforms where it is relatively cheap for
-            // us to do so.
-            if (as != AS_Unknown)
-            {
-                hr = GetCurrentThreadTypeNT5(&type);
-                if (hr == S_OK)
-                {
-                    if (type == THDTYPE_PROCESSMESSAGES && as == AS_InMTA)
-                    {
-                        pProbe->ReportViolation(this, as, FALSE);
-                    }
-                    else if (type == THDTYPE_BLOCKMESSAGES && as == AS_InSTA)
-                    {
-                        pProbe->ReportViolation(this, as, FALSE);
-                    }
-                }
-            }
-        }
-#endif
-
         if (as == AS_Unknown)
         {
             hr = GetCurrentThreadTypeNT5(&type);
@@ -4998,12 +4966,6 @@ Thread::ApartmentState Thread::SetApartment(ApartmentState state, BOOL fFireMDAO
     // MTA.
     if (m_State & TS_InSTA)
     {
-#ifdef MDA_SUPPORTED
-        if (state == AS_InMTA && fFireMDAOnMismatch)
-        {
-            MDA_TRIGGER_ASSISTANT(InvalidApartmentStateChange, ReportViolation(this, state, TRUE));
-        }
-#endif
         return AS_InSTA;
     }
 
@@ -5011,12 +4973,6 @@ Thread::ApartmentState Thread::SetApartment(ApartmentState state, BOOL fFireMDAO
     // STA.
     if (m_State & TS_InMTA)
     {
-#ifdef MDA_SUPPORTED
-        if (state == AS_InSTA && fFireMDAOnMismatch)
-        {
-            MDA_TRIGGER_ASSISTANT(InvalidApartmentStateChange, ReportViolation(this, state, TRUE));
-        }
-#endif
         return AS_InMTA;
     }
 
@@ -5078,15 +5034,6 @@ Thread::ApartmentState Thread::SetApartment(ApartmentState state, BOOL fFireMDAO
         // we can work out what the state is now.  No need to actually do the CoInit --
         // obviously someone else already took care of that.
         FastInterlockOr((ULONG *) &m_State, ((state == AS_InSTA) ? TS_InMTA : TS_InSTA));
-
-#ifdef MDA_SUPPORTED
-        if (fFireMDAOnMismatch)
-        {
-            // Report via the customer debug helper that we failed to set the apartment type
-            // to the specified type.
-            MDA_TRIGGER_ASSISTANT(InvalidApartmentStateChange, ReportViolation(this, state, TRUE));
-        }
-#endif
     }
     else if (hr == E_OUTOFMEMORY)
     {
@@ -8664,55 +8611,6 @@ BOOL dbgOnly_IsSpecialEEThread()
 #endif // _DEBUG
 
 
-// There is an MDA which can detect illegal reentrancy into the CLR.  For instance, if you call managed
-// code from a native vectored exception handler, this might cause a reverse PInvoke to occur.  But if the
-// exception was triggered from code that was executing in cooperative GC mode, we now have GC holes and
-// general corruption.
-#ifdef MDA_SUPPORTED
-NOINLINE BOOL HasIllegalReentrancyRare()
-{
-    CONTRACTL
-    {
-        NOTHROW;
-        GC_TRIGGERS;
-        ENTRY_POINT;
-        MODE_ANY;
-    }
-    CONTRACTL_END;
-
-    Thread *pThread = GetThread();
-    if (pThread == NULL || !pThread->PreemptiveGCDisabled())
-        return FALSE;
-
-    BEGIN_ENTRYPOINT_VOIDRET;
-    MDA_TRIGGER_ASSISTANT(Reentrancy, ReportViolation());
-    END_ENTRYPOINT_VOIDRET;
-    return TRUE;
-}
-#endif
-
-// Actually fire the Reentrancy probe, if warranted.
-BOOL HasIllegalReentrancy()
-{
-    CONTRACTL
-    {
-        NOTHROW;
-        GC_TRIGGERS;
-        ENTRY_POINT;
-        MODE_ANY;
-    }
-    CONTRACTL_END;
-
-#ifdef MDA_SUPPORTED
-    if (NULL == MDA_GET_ASSISTANT(Reentrancy))
-        return FALSE;
-    return HasIllegalReentrancyRare();
-#else
-    return FALSE;
-#endif // MDA_SUPPORTED
-}
-
-
 #endif // #ifndef DACCESS_COMPILE
 
 #ifdef DACCESS_COMPILE
index fcc7922..66d0672 100644 (file)
@@ -421,22 +421,6 @@ public:
     enum ApartmentState { AS_Unknown };
 #endif
 
-#if defined(FEATURE_COMINTEROP) && defined(MDA_SUPPORTED)
-    void RegisterRCW(RCW *pRCW)
-    {
-    }
-
-    BOOL RegisterRCWNoThrow(RCW *pRCW)
-    {
-        return FALSE;
-    }
-
-    RCW *UnregisterRCW(INDEBUG(SyncBlock *pSB))
-    {
-        return NULL;
-    }
-#endif
-
     DWORD       m_dwLastError;
 };
 
@@ -6526,12 +6510,6 @@ class GCForbidLoaderUseHolder
 #endif  // _DEBUG_IMPL
 #endif // DACCESS_COMPILE
 
-// There is an MDA which can detect illegal reentrancy into the CLR.  For instance, if you call managed
-// code from a native vectored exception handler, this might cause a reverse PInvoke to occur.  But if the
-// exception was triggered from code that was executing in cooperative GC mode, we now have GC holes and
-// general corruption.
-BOOL HasIllegalReentrancy();
-
 // We have numerous places where we start up a managed thread.  This includes several places in the
 // ThreadPool, the 'new Thread(...).Start()' case, and the Finalizer.  Try to factor the code so our
 // base exception handling behavior is consistent across those places.  The resulting code is convoluted,
index 36d1621..cc27406 100644 (file)
@@ -16,8 +16,6 @@
 #include "finalizerthread.h"
 #include "dbginterface.h"
 
-#include "mdaassistants.h"
-
 // from ntstatus.h
 #define STATUS_SUSPEND_COUNT_EXCEEDED    ((NTSTATUS)0xC000004AL)
 
@@ -1423,14 +1421,6 @@ Thread::UserAbort(ThreadAbortRequester requester,
         RaiseTheExceptionInternalOnly(exceptObj, FALSE);
     }
 
-#ifdef MDA_SUPPORTED
-    if (requester != TAR_FuncEval)
-    {
-        // FuncEval abort is always aborting another thread.  No need to trigger MDA.
-        MDA_TRIGGER_ASSISTANT(AsynchronousThreadAbort, ReportViolation(GetThread(), this));
-    }
-#endif
-
     _ASSERTE(this != pCurThread);      // Aborting another thread.
 
     if (client == UAC_Host)