Remove Marshaling MDA (dotnet/coreclr#22579)
authorJeremy Koritzinsky <jkoritzinsky@gmail.com>
Wed, 13 Feb 2019 23:52:35 +0000 (15:52 -0800)
committerGitHub <noreply@github.com>
Wed, 13 Feb 2019 23:52:35 +0000 (15:52 -0800)
Remove the "marshaling" MDA. In .NET Framework it was off by default and in .NET Core it was commented out in the boilerplate file. Additionally, from what I can tell only half of its functionality was ever implemented in .NET Core.

Contributes to dotnet/coreclr#22538.

Commit migrated from https://github.com/dotnet/coreclr/commit/ac27e6badbb195a77c0f81427ffc0d4f837dcc45

src/coreclr/src/vm/fieldmarshaler.cpp
src/coreclr/src/vm/fieldmarshaler.h
src/coreclr/src/vm/mdaBoilerplate.exe.mda.config
src/coreclr/src/vm/mdaassistants.cpp
src/coreclr/src/vm/mdaassistants.h
src/coreclr/src/vm/methodtablebuilder.cpp

index e0b3a4a..5a72b89 100644 (file)
@@ -4415,359 +4415,6 @@ VOID FieldMarshaler_Variant::DestroyNativeImpl(LPVOID pNativeValue) const
 
 #endif // FEATURE_COMINTEROP
 
-
-#ifdef _PREFAST_
-#pragma warning(push)
-#pragma warning(disable:21000) // Suppress PREFast warning about overly large function
-#endif
-VOID NStructFieldTypeToString(FieldMarshaler* pFM, SString& strNStructFieldType)
-{
-    CONTRACTL
-    {
-        THROWS;
-        GC_NOTRIGGER;
-        MODE_ANY;
-        INJECT_FAULT(COMPlusThrowOM());
-        PRECONDITION(CheckPointer(pFM));
-    }
-    CONTRACTL_END;
-
-    NStructFieldType cls = pFM->GetNStructFieldType();
-    LPCWSTR  strRetVal;
-    CorElementType elemType = pFM->GetFieldDesc()->GetFieldType();
-
-    // Some NStruct Field Types have extra information and require special handling.
-    if (cls == NFT_FIXEDCHARARRAYANSI)
-    {
-        strNStructFieldType.Printf(W("fixed array of ANSI char (size = %i bytes)"), pFM->NativeSize());
-        return;
-    }
-    else if (cls == NFT_FIXEDARRAY)
-    {
-        VARTYPE vtElement = ((FieldMarshaler_FixedArray*)pFM)->GetElementVT();
-        TypeHandle thElement = ((FieldMarshaler_FixedArray*)pFM)->GetElementTypeHandle();
-        BOOL fElementTypeUserDefined = FALSE;
-
-        // Determine if the array type is a user defined type.
-        if (vtElement == VT_RECORD)
-        {
-            fElementTypeUserDefined = TRUE;
-        }
-        else if (vtElement == VT_UNKNOWN || vtElement == VT_DISPATCH)
-        {
-            fElementTypeUserDefined = !thElement.IsObjectType();
-        }
-
-        // Retrieve the string representation for the VARTYPE.
-        StackSString strVarType;
-        MarshalInfo::VarTypeToString(vtElement, strVarType);
-
-        MethodTable *pMT = ((FieldMarshaler_FixedArray*)pFM)->GetElementTypeHandle().GetMethodTable();
-        DefineFullyQualifiedNameForClassW();
-        WCHAR* szClassName = (WCHAR*)GetFullyQualifiedNameForClassW(pMT);
-
-        if (fElementTypeUserDefined)
-        {
-            strNStructFieldType.Printf(W("fixed array of %s exposed as %s elements (array size = %i bytes)"),
-                                       szClassName,
-                                       strVarType.GetUnicode(), pFM->NativeSize());
-        }
-        else
-        {
-            strNStructFieldType.Printf(W("fixed array of %s (array size = %i bytes)"), 
-                szClassName, pFM->NativeSize());
-        }
-
-        return;
-    }
-#ifdef FEATURE_COMINTEROP
-    else if (cls == NFT_INTERFACE)
-    {
-        MethodTable *pItfMT     = NULL;
-        DWORD       dwFlags     = 0;
-
-        ((FieldMarshaler_Interface*)pFM)->GetInterfaceInfo(&pItfMT, &dwFlags);
-
-        if (dwFlags & ItfMarshalInfo::ITF_MARSHAL_DISP_ITF)
-        {
-            strNStructFieldType.Set(W("IDispatch "));
-        }
-        else
-        {
-            strNStructFieldType.Set(W("IUnknown "));
-        }
-
-        if (dwFlags & ItfMarshalInfo::ITF_MARSHAL_USE_BASIC_ITF)
-        {
-            strNStructFieldType.Append(W("(basic) "));
-        }
-            
-
-        if (pItfMT)
-        {
-            DefineFullyQualifiedNameForClassW();
-            GetFullyQualifiedNameForClassW(pItfMT);
-
-            strNStructFieldType.Append(GetFullyQualifiedNameForClassW(pItfMT));
-        }
-
-        return;
-    }
-#ifdef FEATURE_CLASSIC_COMINTEROP
-    else if (cls == NFT_SAFEARRAY)
-    {
-        VARTYPE vtElement = ((FieldMarshaler_SafeArray*)pFM)->GetElementVT();
-        TypeHandle thElement = ((FieldMarshaler_SafeArray*)pFM)->GetElementTypeHandle();
-        BOOL fElementTypeUserDefined = FALSE;
-
-        // Determine if the array type is a user defined type.
-        if (vtElement == VT_RECORD)
-        {
-            fElementTypeUserDefined = TRUE;
-        }
-        else if (vtElement == VT_UNKNOWN || vtElement == VT_DISPATCH)
-        {
-            fElementTypeUserDefined = !thElement.IsObjectType();
-        }
-
-        // Retrieve the string representation for the VARTYPE.
-        StackSString strVarType;
-        MarshalInfo::VarTypeToString(vtElement, strVarType);
-
-
-        StackSString strClassName;
-        if (!thElement.IsNull())
-        {
-            DefineFullyQualifiedNameForClassW();
-            MethodTable *pMT = ((FieldMarshaler_SafeArray*)pFM)->GetElementTypeHandle().GetMethodTable();
-            strClassName.Set((WCHAR*)GetFullyQualifiedNameForClassW(pMT));
-        }
-        else
-        {
-            strClassName.Set(W("object"));
-        }
-        
-        if (fElementTypeUserDefined)
-        {
-            strNStructFieldType.Printf(W("safe array of %s exposed as %s elements (array size = %i bytes)"),
-                                       strClassName.GetUnicode(),
-                                       strVarType.GetUnicode(), pFM->NativeSize());
-        }
-        else
-        {
-            strNStructFieldType.Printf(W("safearray of %s (array size = %i bytes)"), 
-                strClassName.GetUnicode(), pFM->NativeSize());
-        }
-        
-        return;            
-    }
-#endif // FEATURE_CLASSIC_COMINTEROP
-#endif // FEATURE_COMINTEROP
-    else if (cls == NFT_NESTEDLAYOUTCLASS)
-    {
-        MethodTable *pMT = ((FieldMarshaler_NestedLayoutClass*)pFM)->GetMethodTable();
-        DefineFullyQualifiedNameForClassW();
-        strNStructFieldType.Printf(W("nested layout class %s"),
-                                   GetFullyQualifiedNameForClassW(pMT));
-        return;
-    }
-    else if (cls == NFT_NESTEDVALUECLASS)
-    {
-        MethodTable     *pMT                = ((FieldMarshaler_NestedValueClass*)pFM)->GetMethodTable();
-        DefineFullyQualifiedNameForClassW();
-        strNStructFieldType.Printf(W("nested value class %s"),
-                                   GetFullyQualifiedNameForClassW(pMT));
-        return;
-    }
-    else if (cls == NFT_COPY1)
-    {
-        // The following CorElementTypes are the only ones handled with FieldMarshaler_Copy1. 
-        switch (elemType)
-        {
-            case ELEMENT_TYPE_I1:
-                strRetVal = W("SByte");
-                break;
-
-            case ELEMENT_TYPE_U1:
-                strRetVal = W("Byte");
-                break;
-
-            default:
-                strRetVal = W("Unknown");
-                break;
-        }
-    }
-    else if (cls == NFT_COPY2)
-    {
-        // The following CorElementTypes are the only ones handled with FieldMarshaler_Copy2. 
-        switch (elemType)
-        {
-            case ELEMENT_TYPE_CHAR:
-                strRetVal = W("Unicode char");
-                break;
-
-            case ELEMENT_TYPE_I2:
-                strRetVal = W("Int16");
-                break;
-
-            case ELEMENT_TYPE_U2:
-                strRetVal = W("UInt16");
-                break;
-
-            default:
-                strRetVal = W("Unknown");
-                break;
-        }
-    }
-    else if (cls == NFT_COPY4)
-    {
-        // The following CorElementTypes are the only ones handled with FieldMarshaler_Copy4. 
-        switch (elemType)
-        {
-            // At this point, ELEMENT_TYPE_I must be 4 bytes long.  Same for ELEMENT_TYPE_U.
-            case ELEMENT_TYPE_I:
-            case ELEMENT_TYPE_I4:
-                strRetVal = W("Int32");
-                break;
-
-            case ELEMENT_TYPE_U:
-            case ELEMENT_TYPE_U4:
-                strRetVal = W("UInt32");
-                break;
-
-            case ELEMENT_TYPE_R4:
-                strRetVal = W("Single");
-                break;
-
-            case ELEMENT_TYPE_PTR:
-                strRetVal = W("4-byte pointer");
-                break;
-
-            default:
-                strRetVal = W("Unknown");
-                break;
-        }
-    }
-    else if (cls == NFT_COPY8)
-    {
-        // The following CorElementTypes are the only ones handled with FieldMarshaler_Copy8. 
-        switch (elemType)
-        {
-            // At this point, ELEMENT_TYPE_I must be 8 bytes long.  Same for ELEMENT_TYPE_U.
-            case ELEMENT_TYPE_I:
-            case ELEMENT_TYPE_I8:
-                strRetVal = W("Int64");
-                break;
-
-            case ELEMENT_TYPE_U:
-            case ELEMENT_TYPE_U8:
-                strRetVal = W("UInt64");
-                break;
-
-            case ELEMENT_TYPE_R8:
-                strRetVal = W("Double");
-                break;
-
-            case ELEMENT_TYPE_PTR:
-                strRetVal = W("8-byte pointer");
-                break;
-
-            default:
-                strRetVal = W("Unknown");
-                break;
-        }
-    }
-    else if (cls == NFT_FIXEDSTRINGUNI)
-    {
-        int nativeSize = pFM->NativeSize();
-        int strLength = nativeSize / sizeof(WCHAR);
-
-        strNStructFieldType.Printf(W("embedded LPWSTR (length %d)"), strLength);
-        
-        return;
-    }
-    else if (cls == NFT_FIXEDSTRINGANSI)
-    {
-        int nativeSize = pFM->NativeSize();
-        int strLength = nativeSize / sizeof(CHAR);
-
-        strNStructFieldType.Printf(W("embedded LPSTR (length %d)"), strLength);
-
-        return;
-    }
-    else
-    {
-        // All other NStruct Field Types which do not require special handling.
-        switch (cls)
-        {
-            case NFT_BSTR:
-                strRetVal = W("BSTR");
-                break;
-#ifdef FEATURE_COMINTEROP                
-            case NFT_HSTRING:
-                strRetVal = W("HSTRING");
-                break;
-#endif  // FEATURE_COMINTEROP
-            case NFT_STRINGUNI:
-                strRetVal = W("LPWSTR");
-                break;
-            case NFT_STRINGANSI:
-                strRetVal = W("LPSTR");
-                break;
-            case NFT_DELEGATE:
-                strRetVal = W("Delegate");
-                break;
-#ifdef FEATURE_COMINTEROP
-            case NFT_VARIANT:
-                strRetVal = W("VARIANT");
-                break;
-#endif  // FEATURE_COMINTEROP
-            case NFT_ANSICHAR:
-                strRetVal = W("ANSI char");
-                break;
-            case NFT_WINBOOL:
-                strRetVal = W("Windows Bool");
-                break;
-            case NFT_CBOOL:
-                strRetVal = W("CBool");
-                break;
-            case NFT_DECIMAL:
-                strRetVal = W("DECIMAL");
-                break;
-            case NFT_DATE:
-                strRetVal = W("DATE");
-                break;
-#ifdef FEATURE_COMINTEROP
-            case NFT_VARIANTBOOL:
-                strRetVal = W("VARIANT Bool");
-                break;
-            case NFT_CURRENCY:
-                strRetVal = W("CURRENCY");
-                break;
-#endif  // FEATURE_COMINTEROP
-            case NFT_ILLEGAL:
-                strRetVal = W("illegal type");
-                break;
-            case NFT_SAFEHANDLE:
-                strRetVal = W("SafeHandle");
-                break;
-            case NFT_CRITICALHANDLE:
-                strRetVal = W("CriticalHandle");
-                break;
-            default:
-                strRetVal = W("<UNKNOWN>");
-                break;
-        }
-    }
-
-    strNStructFieldType.Set(strRetVal);
-
-    return;
-}
-#ifdef _PREFAST_
-#pragma warning(pop)
-#endif
-
 #endif // CROSSGEN_COMPILE
 
 
index 55e7773..2e1b011 100644 (file)
@@ -67,8 +67,6 @@ class FieldMarshaler_Exception;
 class FieldMarshaler_Nullable;
 #endif // FEATURE_COMINTEROP
 
-VOID NStructFieldTypeToString(FieldMarshaler* pFM, SString& strNStructFieldType);
-
 //=======================================================================
 // Each possible COM+/Native pairing of data type has a
 // NLF_* id. This is used to select the marshaling code.
index c75d7aa..336bef3 100644 (file)
@@ -929,17 +929,6 @@ ACTIVATION\REPORTING SCENARIOS:
         -->
           <reportAvOnComRelease allowAv="false" enable="false" />
 
-          <!-- 
-            Marshaling (chriseck)  
-            
-            DESCRIPTION:
-            This assistant fires when the CLR sets up marshaling information for a method parameter or a field of a structure.  
-            It prints out the type of the parameter or field both in the managed and unmanaged worlds, as well as indicating 
-            the structure or method where the type lives.                                             
-        <marshaling enable="false" />
-        -->
-
-
         <!-- 
             VirtualCERCall (rudim)                       
 
index a416fec..c3e1375 100644 (file)
@@ -1365,239 +1365,6 @@ void MdaMarshalCleanupError::ReportErrorCustomMarshalerCleanup(TypeHandle typeCu
 }
 
 //
-// MdaMarshaling
-//
-void MdaMarshaling::Initialize(MdaXmlElement* pXmlInput)
-{
-    CONTRACTL
-    {
-        THROWS;
-        GC_TRIGGERS;
-        MODE_ANY;
-    }
-    CONTRACTL_END;
-    
-    m_pMethodFilter = new MdaQuery::CompiledQueries();
-    m_pFieldFilter = new MdaQuery::CompiledQueries();
-
-    MdaXmlElement* pXmlMethodFilter = pXmlInput->GetChild(MdaElemDecl(MethodFilter));
-    if (pXmlMethodFilter)
-        MdaQuery::Compile(pXmlMethodFilter, m_pMethodFilter);
-
-    MdaXmlElement* pXmlFieldFilter = pXmlInput->GetChild(MdaElemDecl(FieldFilter));
-    if (pXmlFieldFilter)
-        MdaQuery::Compile(pXmlFieldFilter, m_pFieldFilter);
-}
-
-void MdaMarshaling::ReportFieldMarshal(FieldMarshaler* pFM)
-{
-    CONTRACTL
-    {
-        THROWS;
-        GC_TRIGGERS;
-        MODE_ANY;
-        PRECONDITION(CheckPointer(pFM));
-    }
-    CONTRACTL_END;
-
-    FieldDesc* pFD = pFM->GetFieldDesc();
-
-    if (!pFD || !m_pFieldFilter->Test(pFD))
-        return;
-
-    MdaXmlElement* pXml;
-    MdaXmlMessage msg(this->AsMdaAssistant(), FALSE, &pXml);
-    
-    MdaXmlElement* pField = pXml->AddChild(MdaElemDecl(MarshalingField));
-    AsMdaAssistant()->OutputFieldDesc(pFD, pField);
-
-    StackSString sszField;
-    SString managed;
-    SString unmanaged;
-        
-    GetManagedSideForField(managed, pFD);
-    GetUnmanagedSideForField(unmanaged, pFM);
-
-    msg.SendMessagef(MDARC_MARSHALING_FIELD, AsMdaAssistant()->ToString(sszField, pFD).GetUnicode(), managed.GetUnicode(), unmanaged.GetUnicode());
-}
-
-
-void MdaMarshaling::GetManagedSideForField(SString& strManagedMarshalType, FieldDesc* pFD)
-{
-    CONTRACTL
-    {
-        THROWS;
-        GC_TRIGGERS;
-        MODE_ANY;
-    }
-    CONTRACTL_END;
-
-    if (!CheckForPrimitiveType(pFD->GetFieldType(), strManagedMarshalType))
-    {
-        // The following workaround is added to avoid a recursion caused by calling GetTypeHandle on
-        // the m_value field of the UIntPtr class.
-        LPCUTF8 szNamespace, szClassName;
-        IfFailThrow(pFD->GetMDImport()->GetNameOfTypeDef(pFD->GetApproxEnclosingMethodTable()->GetCl(), &szClassName, &szNamespace));
-        
-        if (strcmp(szNamespace, "System") == 0 && strcmp(szClassName, "UIntPtr") == 0)
-        {
-            static LPWSTR strRetVal = W("Void*");
-            strManagedMarshalType.Set(strRetVal);
-        }
-        else
-        {
-            MetaSig fSig(pFD);
-            fSig.NextArgNormalized();
-            TypeHandle th = fSig.GetLastTypeHandleNT();
-            if (th.IsNull())
-            {
-                static const WCHAR strErrorMsg[] = W("<error>");
-                strManagedMarshalType.Set(strErrorMsg);
-            }
-            else
-            {
-                SigFormat sigFmt;
-                sigFmt.AddType(th);
-                UINT iManagedTypeLen = (UINT)strlen(sigFmt.GetCString()) + 1;
-
-                WCHAR* buffer = strManagedMarshalType.OpenUnicodeBuffer(iManagedTypeLen);
-                MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, sigFmt.GetCString(), -1, buffer, iManagedTypeLen);
-                strManagedMarshalType.CloseBuffer();
-            }
-        }
-    }
-}
-
-void MdaMarshaling::GetUnmanagedSideForField(SString& strUnmanagedMarshalType, FieldMarshaler* pFM)
-{
-    CONTRACTL
-    {
-        THROWS;
-        GC_NOTRIGGER;
-        MODE_ANY;
-    }
-    CONTRACTL_END;
-
-    NStructFieldTypeToString(pFM, strUnmanagedMarshalType);
-}
-
-
-void MdaMarshaling::GetManagedSideForMethod(SString& strManagedMarshalType, Module* pModule, SigPointer sig, CorElementType elemType)
-{
-    CONTRACTL
-    {
-        THROWS;
-        GC_TRIGGERS;
-        MODE_ANY;
-    }
-    CONTRACTL_END;
-
-    if (!CheckForPrimitiveType(elemType, strManagedMarshalType))
-    {        
-        // an empty type context is sufficient: all methods should be non-generic
-        SigTypeContext emptyTypeContext;
-
-        TypeHandle th = sig.GetTypeHandleNT(pModule, &emptyTypeContext);
-        if (th.IsNull())
-        {
-            strManagedMarshalType.Set(W("<error>"));
-        }
-        else
-        {
-            SigFormat sigfmt;
-            sigfmt.AddType(th);
-            UINT iManagedMarshalTypeLength = MultiByteToWideChar( CP_ACP, MB_PRECOMPOSED, sigfmt.GetCString(), -1, NULL, 0);
-                
-            WCHAR* str = strManagedMarshalType.OpenUnicodeBuffer(iManagedMarshalTypeLength);
-            MultiByteToWideChar( CP_ACP, MB_PRECOMPOSED, sigfmt.GetCString(), -1, str, iManagedMarshalTypeLength);
-            strManagedMarshalType.CloseBuffer();
-        }
-    }  
-}
-
-
-void MdaMarshaling::GetUnmanagedSideForMethod(SString& strNativeMarshalType, MarshalInfo* mi, BOOL fSizeIsSpecified)
-{
-    CONTRACTL
-    {
-        THROWS;
-        GC_TRIGGERS;
-        MODE_ANY;
-    }
-    CONTRACTL_END;
-    
-    mi->MarshalTypeToString(strNativeMarshalType, fSizeIsSpecified);    
-}
-
-BOOL MdaMarshaling::CheckForPrimitiveType(CorElementType elemType, SString& strPrimitiveType)
-{
-    CONTRACTL
-    {
-        THROWS;
-        GC_NOTRIGGER;
-        MODE_ANY;
-        INJECT_FAULT(COMPlusThrowOM());
-    }
-    CONTRACTL_END;
-    
-    LPWSTR  strRetVal;
-
-    switch (elemType)
-    {
-        case ELEMENT_TYPE_VOID:
-            strRetVal = W("Void");
-            break;
-        case ELEMENT_TYPE_BOOLEAN:
-            strRetVal = W("Boolean");
-            break;
-        case ELEMENT_TYPE_I1:
-            strRetVal = W("SByte");
-            break;
-        case ELEMENT_TYPE_U1:
-            strRetVal = W("Byte");
-            break;
-        case ELEMENT_TYPE_I2:
-            strRetVal = W("Int16");
-            break;
-        case ELEMENT_TYPE_U2:
-            strRetVal = W("UInt16");
-            break;
-        case ELEMENT_TYPE_CHAR:
-            strRetVal = W("Char");
-            break;
-        case ELEMENT_TYPE_I:
-            strRetVal = W("IntPtr");
-            break;
-        case ELEMENT_TYPE_U:
-            strRetVal = W("UIntPtr");
-            break;
-        case ELEMENT_TYPE_I4:
-            strRetVal = W("Int32"); 
-            break;
-        case ELEMENT_TYPE_U4:       
-            strRetVal = W("UInt32"); 
-            break;
-        case ELEMENT_TYPE_I8:       
-            strRetVal = W("Int64"); 
-            break;
-        case ELEMENT_TYPE_U8:       
-            strRetVal = W("UInt64"); 
-            break;
-        case ELEMENT_TYPE_R4:       
-            strRetVal = W("Single"); 
-            break;
-        case ELEMENT_TYPE_R8:       
-            strRetVal = W("Double"); 
-            break;
-        default:
-            return FALSE;
-    }
-
-    strPrimitiveType.Set(strRetVal);
-    return TRUE;
-}
-
-//
 // MdaLoaderLock
 //
 void MdaLoaderLock::ReportViolation(HINSTANCE hInst)
index 03454cb..7b83fae 100644 (file)
@@ -600,30 +600,6 @@ public:
 };
 
 //
-// MdaMarshaling
-//
-class MdaMarshaling
-{
-public:
-    void Initialize(MdaXmlElement* pXmlInput);
-    void ReportFieldMarshal(FieldMarshaler* pFM);
-  
-private:
-    void GetManagedSideForMethod(SString& strManagedMarshalType, Module* pModule, SigPointer sig, CorElementType elemType);
-    void GetUnmanagedSideForMethod(SString& strNativeMarshalType, MarshalInfo* mi, BOOL fSizeIsSpecified);
-    void GetManagedSideForField(SString& strManagedMarshalType, FieldDesc* pFD);
-    void GetUnmanagedSideForField(SString& strUnmanagedMarshalType, FieldMarshaler* pFM);
-    BOOL CheckForPrimitiveType(CorElementType elemType, SString& strPrimitiveType);
-
-public:
-    MDA_ASSISTANT_BASE_MEMBERS;
-    MdaQuery::CompiledQueries* m_pMethodFilter;
-    MdaQuery::CompiledQueries* m_pFieldFilter;
-};
-
-
-
-//
 // InvalidFunctionPointerInDelegate
 //
 class MdaInvalidFunctionPointerInDelegate
index ab9e1c5..5eef5ab 100644 (file)
@@ -2073,22 +2073,6 @@ MethodTableBuilder::BuildMethodTableThrowing(
         GetCl(),
         GetHalfBakedMethodTable());
 
-#ifdef MDA_SUPPORTED
-    MdaMarshaling* mda = MDA_GET_ASSISTANT(Marshaling);
-    if (mda && HasLayout())
-    {
-        FieldMarshaler *pFieldMarshaler = (FieldMarshaler*)GetLayoutInfo()->GetFieldMarshalers();
-        UINT  numReferenceFields        = GetLayoutInfo()->GetNumCTMFields();
-
-        while (numReferenceFields--)
-        {
-            mda->ReportFieldMarshal(pFieldMarshaler);
-
-            ((BYTE*&)pFieldMarshaler) += MAXFIELDMARSHALERSIZE;
-        }
-    }
-#endif // MDA_SUPPORTED
-
 #ifdef FEATURE_PREJIT
     _ASSERTE(pComputedPZM == Module::GetPreferredZapModuleForMethodTable(pMT));
 #endif // FEATURE_PREJIT