question

Rajeshwarikanchiraju avatar image
0 Votes"
Rajeshwarikanchiraju asked XingyuZhao-MSFT commented

Attach .Net Profiler at RunTime to a running process

Hi ,

I have been trying to attach the .Net Profiler at Runtime to a running process using the PID information .

I could able to use attachprofiler() method and call Initializeforattach() method.

Im trying to set the masks -"COR_PRF_ENABLE_REJIT" & "COR_PRF_DISABLE_ALL_NGEN_IMAGES" inside the initializeforattach() method using "SetEventMask()" method but its getting failed.

Inside the Initializeforattach() , I have used "ICorProfilerInfo4" object for QueryInterface().

@Brian-7574 Please help me why seteventmasks() getting failed and unable to load the modules.

Any reference is much appreciated.

Thanks in advance.

dotnet-runtime
· 7
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @Rajeshwarikanchiraju ,
In order to help us analyze the problem, could you share more related code here?
We are waiting for your update.

0 Votes 0 ·

Hi @XingyuZhao-MSFT


Thanks for your reply.

I'm trying to set the event masks in the Initializeforattach() for "COR_PRF_ENABLE_REJIT" which is getting failed, Here is the below code snippet which I have used

InitializeForAttach(
/ [in] / IUnknown pICorProfilerInfoUnk,
/
[in] / void pvClientData,
/
[in]
/ UINT cbClientData)
{ HRESULT hr;
hr = pICorProfilerInfoUnk->QueryInterface(IID_ICorProfilerInfo4, (void )&m_pProfilerInfo4);
hr = pICorProfilerInfoUnk->QueryInterface(IID_ICorProfilerInfo3, (void
)&m_pProfilerInfo3);
hr = pICorProfilerInfoUnk->QueryInterface(IID_ICorProfilerInfo2, (void **)&m_pProfilerInfo);
.
.
.
.
.
hr = m_pProfilerInfo->SetEventMask( COR_PRF_MONITOR_JIT_COMPILATION |COR_PRF_MONITOR_MODULE_LOADS|COR_PRF_MONITOR_MODULE_LOADS|COR_PRF_ENABLE_REJIT | COR_PRF_DISABLE_ALL_NGEN_IMAGES );
.
.
.
.
}


Please help me if i would have missed anything

0 Votes 0 ·

Hi @Rajeshwarikanchiraju ,
I note that SetEventMask2 is the recommended alternative to the SetEventMask method, so you can use SetEventMask2 method to do it.


0 Votes 0 ·
Show more comments

0 Answers