Process attaching fails when program uses Performance Counter

Hello,
I have recently experienced problem using Nsight Graphics. The program I’m trying to profile/debug is C# application which is using performance counters.
Once I launch the app from Nsight Graphics the attaching is stuck - no rendering starts, it seems the problem occurs before the render device is created. The application works fine outside Nsight scope.
I have tracked down the source of this problem to performance counters - if I stop using them, launch of the application inside Nsight goes without any problem.

Is this limitation of the Nsight? Is this a bug?
(if needed I can prepare simple example)

Thanks a lot in advance
Tomas Drinovsky

Hello,
Thank you for using Nsight Graphics and your feedback. Sorry you have run into this issue. I discussed with our engineer here and we would like for you to describe what the performance counter library you are using and likely we may need you to provide a reproducible sample. You can contact me at dwoods@nvidia.com to discuss on email.
Regards,

Hi Tomas,

I’m sorry you ran into this problem. I investigated it with the minimal reproducible you provided, and I found that the Nsight-injected application was hanging deep within operating system loading code. I do not know why this is. I was able to find a possible workaround for you, though, that I cannot promise will be fully reliable, but may help in your case.

In our upcoming 2021.4 version (expected to be released within the next two weeks), if you add NVIDIA_PROCESS_INJECTION_NTUNMAPVIEWOFSECTION_INTERCEPTION_BEHAVIOR=0 into the environment options section, it will suppress a capability for tracking library frees, which could very much cause problems for some applications, but seems to work around the issue in my limited testing of your example. The alternative to this option would be to suppress your usage of performance counters on your side, of course. Other than these options, given that the hang is deep within windows loading code, I don’t see how we can provide a more clean solution.

I hope this is useful,

Dan

Hello,
thanks a lot for the workaround. Looking forward to next version.
For my purposes I have no problem disabling the perf counters. So I will do that. Let’s hope this post will help other people too :)

Best Regards
Tomas

Hello,

Nsight Graphics 2021.4.0 is now available. Please let us know if you still have any issues.

Regards,