What the returned ContextID from ICorProfilerInfo::GetThreadContext can be used? Can ThreadLocalStorage data be access via it? RRS feed

  • Question

  •  I am coding a CLR profiler, want to get the TLS data, is there a way by profiler?



    Tuesday, March 4, 2014 3:51 AM

All replies

  • Hi YongMing,

    I am trying to involve someone familiar with this issue to come into this thread. Thank you for your understanding.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Tuesday, March 4, 2014 7:49 AM
  • Thanks. My question is mainly about how to get the managed thread local storage data from CLR profiler unmanaged code.


    Tuesday, March 4, 2014 9:46 AM
  • Which TLS data do you mean? OS TLS can be accessed via OSThreadID and some Win32 API.

    Managed TLS is defined by ThreadStaticAttribute on field and should be accessible via ICorProfilerInfo2::GetThreadStaticAddress, you don't need ContextID for it.


    Thursday, March 6, 2014 9:31 PM
  • Karel,

       Thanks a lot for your explanation. TLS here means Thread Local Storage as your understanding.

       One more thing need your confirmation: when using ICorProfiler interface to instrument ELT callback into IL methods, whether the unmanaged profiler callback code runs in the same thread with the intercepted managed methods?  As you know, the thread id gotten in managed code is different with the thread id gotten by COM ICorProfilerInfo or Windows API, there seems no way to mapping currntly.

    Thanks in advance!


    Friday, March 7, 2014 9:03 AM
  • Hi Karel,

       I can't find any sample code for ICorProfilerInfo2::GetThreadStaticAddress . Can you give me an example or some hints on using it? Thanks!




    Monday, March 10, 2014 5:49 AM