How to profile a Custom Control at design time in .net


I'm using a custom control (Data binding control , similar to .net DataGridView), which is a very big architecture. I've added this control to a Form and when this form is in open and when I click on rebuild, then the whole Form and VS (using Visual studio 2008) hangs for a while ( say about 1 min to hrs) based on no of control and binding source that I use.

So I want to find the root cause of what's consuming time and hence i followed the below to profile.

1) opened ANTS Performance profiler
2) Invoked "Devenv.exe" from "C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\devenv.exe" and loaded my project.
3)I've opened the form and rebuild the project and the Form hangs as i expected, but couldn't get the exact details of what i wanted, since the profiler shows the period of time is used for "Transition to Managed Code".

4) I've replaced the Custom Control with datagridview and everything works fine. So It's clearly the issue exist with the custom control. How do i can find where the CPU spends much of its time when i use the custom control and rebuild. I'm not sure if the above steps that i follow is correct to profile at design time. Is this right way?

Could some one guide me to right path?



  • 1. Ensure you are using "CPU time"
    2. Ensure you are not selecting "source-code only" options- you will want to see all methods.
    3. Use the methods view and call graph view to show further information about methods that are near the "unmanaged/managed border".

    If all else fails- save your results, send them to: [email protected] and I'll analyse them.

    Hope this helps.
Sign In or Register to comment.