microsoft / microsoft/CLRInstrumentationEngine

clr.dll being loaded unexpectedly by InstrumentationEngine.Extensions.Base

Open
#30 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
C++
Stars
102
Forks
52
Avg merge
13h 11m
Merged PRs (30d)
6

Description

Code that loads clr.dll (in extension base component of ApplicationInsights)

if (bstrModuleName == L"mscorlib.dll")
    {
        std::wstring strModulePath;
        IfFailRet(GetModulePath(strModulePath));

        std::shared_ptr<CModuleMetaDataLoader> spLoader;
        IfFailRet(CreateAndBuildUp(spLoader, strModulePath + ExtensionsBaseOriginalModuleName));
HRESULT CModuleMetaDataLoader::Load()
{
    HRESULT hr = S_OK;

    ATL::CComPtr<IMetaDataDispenserEx> pDisp;

    ATL::CComPtr<ICLRMetaHost> pMetaHost;
    ATL::CComPtr<ICLRRuntimeInfo> pRuntime;
    IfFailRet(CLRCreateInstance(CLSID_CLRMetaHost, IID_ICLRMetaHost, reinterpret_cast<void **>(&pMetaHost)));
    IfFailRet(pMetaHost->GetRuntime(L"v4.0.30319", IID_ICLRRuntimeInfo, reinterpret_cast<void **>(&pRuntime)));
    IfFailRet(pRuntime->GetInterface(CLSID_CorMetaDataDispenser, IID_IMetaDataDispenserEx, reinterpret_cast<void **>(&pDisp)));

The highlighted line causes the following dll’s to load, mentioned earlier in the thread:

clr.dll     clr.dll     C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll            N/A        N/A        Symbols loaded.                C:\Users\wiktork\AppData\Local\Temp\SymbolCache\clr.pdb\8354a7bf1cd24de5827c9128420bda702\clr.pdb                25           4.7.3190.0 built by: NET472REL1LAST_C 8/6/2018 11:16 PM         742B0000-7499F000        [1616] ConsoleApplication9.exe                              
msvcr120_clr0400.dll      msvcr120_clr0400.dll      C:\Windows\SysWOW64\msvcr120_clr0400.dll  N/A        N/A                Symbols loaded. C:\Users\wiktork\AppData\Local\Temp\SymbolCache\msvcr120_clr0400.i386.pdb\915fa55e7772460c947f83560680967a1\msvcr120_clr0400.i386.pdb                27           12.00.52519.0 built by: VSWINSERVICING             12/8/2016 4:21 PM         741B0000-742A5000                [1616] ConsoleApplication9.exe                

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in the InstrumentationEngine.Extensions.Base component at the bstrModuleName check and CModuleMetaDataLoader::Load, then inspect the CLRCreateInstance, GetRuntime, and GetInterface calls. Reproduce the load behavior with the ConsoleApplication9.exe context described in the report; the issue does not specify the desired behavior or a concrete completion condition.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
devtools, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.