Skip to content

Raw profiler hook doesn't work with a profiler that adds methods #370

Description

I'm testing my Instrumentation Method by running it along side a profiler provided by a popular APM vendor. The program (a web server) fails to start with the following error:

Unhandled exception. System.TypeLoadException: Could not load type '__DDVoidMethodType__' from assembly 'CoreAspnetMvcWebApp, Version=0.2.7.0, Culture=neutral, PublicKeyToken=null' because the method '__DDVoidMethodCall__' has no implementation (no RVA).

I think this is because MicrosoftInstrumentationEngine::CCorProfilerInfoWrapper::SetILFunctionBody fails to find a CMethodInfo for the newly added method. I've tried to add fix this by calling m_pRealCorProfilerInfo->SetILFunctionBody, under the assumption instrumentation methods won't need see the newly added method, but this does not seem to work. Here is the fix I was testing: robertpi@22b96b5#diff-4ddd686c604ac947d1ae58bc2b3cdedd0b15be84d9432579d6b1f6abc1acd4bcR474

However, the IL seems to get corrupted in some way when I do this, because now when I run the program I see one of these two errors:

Unhandled exception. System.InvalidProgramException: Common Language Runtime detected an invalid program.
    at __DDVoidMethodType__.__DDVoidMethodCall__()

or

Unhandled exception. System.BadImageFormatException: Bad IL format.
    at __DDVoidMethodType__.__DDVoidMethodCall__()

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions