Share via


IDebugExpressionEvaluator2::PreloadModules

Applies to: yesVisual Studio noVisual Studio for Mac

Note

This article applies to Visual Studio 2017. If you're looking for the latest Visual Studio documentation, see Visual Studio documentation. We recommend upgrading to the latest version of Visual Studio. Download it here

Preloads the modules designated by the specified symbol provider.

Syntax

HRESULT PreloadModules (
    IDebugSymbolProvider* pSym
);
int PreloadModules (
    IDebugSymbolProvider pSym
);

Parameters

pSym
[in] Symbol provider for which the modules will be preloaded.

Return Value

If successful, returns S_OK; otherwise, returns an error code.

Remarks

This optional method is used when you do a hosting-process attach. It gives the EE a chance to 'warm up' as part of the attach.

Example

The following example shows how to implement this method for a ExpressionEvaluatorPackage object that exposes the IDebugExpressionEvaluator2 interface.

STDMETHODIMP ExpressionEvaluatorPackage::PreloadModules
(
    IDebugSymbolProvider *pSym
)
{
    HRESULT hr = NOERROR;
    RuntimeMemberDescriptor  * prtMemberDesc;
    RuntimeClassDescriptor *prtClassDesc;
    CComPtr<IDebugClassField> pClassField;
    IfFalseGo(pSym,E_INVALIDARG);

    prtMemberDesc = &(g_rgRTLangMembers[StandardModuleAttributeCtor]);
    prtClassDesc = &(g_rgRTLangClasses[prtMemberDesc->rtParent]);
    pSym->GetClassTypeByName(prtClassDesc->wszClassName, nmCaseSensitive, &pClassField);

    pClassField = NULL;
    prtMemberDesc = &(g_rgRTLangMembers[LoadAssembly]);
    prtClassDesc = &(g_rgRTLangClasses[prtMemberDesc->rtParent]);
    pSym->GetClassTypeByName(prtClassDesc->wszClassName, nmCaseSensitive, &pClassField);

Error:
    return hr;
}

See also