摘要 |
Modifying computer program code can be performed at or immediately prior to runtime of the computer code in a runtime environment of a common language infrastructure of a language-neutral framework for developing and executing computer applications. A function in a computer program can be modified at runtime by injecting arbitrary code, while mitigating an alteration of a program's call stack. A just-in-time compilation service is used to compile and execute intermediate language code of the program, and the runtime environment sends callback functions to an event-based profiling agent (profiler) attached to the runtime environment. The profiler can trap desired functions, as determined by configuration data, and inject modification code from stub methods in a stub assembly file. The modified code can be sent back to the runtime environment to be executed by the just-in-time compilation service. |