Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 676273
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T00:54:35+00:00 2026-05-14T00:54:35+00:00

I know instrumentation is a technique to add trace code dynamically into the methods

  • 0

I know instrumentation is a technique to add trace code dynamically into the methods to enable tracing and debugging.

I was wondering if this is only a “Trace” option, hard coded into the CLR to add only trace code, or is there the ability to add any code to the methods?

For example, I want to check for a condition in the beginning of every single method call in a certain class (say for permissions). Can I do this via adding dynamic code to the beginning of the methods in execution time?

I’m not sure how this trace “instrumentation” thing works, but I’m wondering if this can be used for other goals too, or not.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T00:54:36+00:00Added an answer on May 14, 2026 at 12:54 am

    Basically what you should do is write a CLR profiler and use the profiler API in c++
    You need to implement the ICorProfilerCallback interface.
    What you are looking for is in the JITCompilationStarted callback. This method is called each time a managed method gets called and before the jit compiler compiles the IL into machine code.
    Any code insertion work during run time should be done in JITCompilationStarted.
    You can look at the open source coverage tool part cover as an example how to do it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Know this might be rather basic, but I been trying to figure out how
I know you can not set a key value dynamically, but what about the
I know that Phonegap has an event for back button, but it's only available
I know that this sort of question has been asked here before, but still
i know this is a stupid question but i d'ont know how to do
I know this is silly question, but i am just stuck with this: 1.I
Does anyone know the resolution to the following error. In this scenario, TFS will
Does anyone know of a way I can code-profile my Windows Sidebar Gadget? I've
As we all know Java 5 introduced the ability for Instrumentation to get the
I am getting the IllegalAccessError while running Android instrumentation tests. This is Logcat output:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.