Share via


How to profile ASP.NET and Silverlight at the same time

In Visual Studio 2010 SP1 we enabled the ability to profile Silverlight applications from the Visual Studio UI. Unfortunately there is a limitation where we cannot automatically attach to multiple processes on launch from inside Visual Studio, so you are still unable to profile ASP.NET and Silverlight at the same time without manually attaching to Internet Explorer after launch. Fortunately, this is relatively simple. 

To profile both Silverlight and ASP.NET at the same time:

  1. Launch your CPU sampling session against your ASP.NET application from Visual Studio

  2. In the Performance Explorer window click “Attach/Detach”

    image

  3. Select the Internet Explorer process that is running your Silverlight application—if you only have one instance of Internet Explorer open with a single tab, the process will be the “iexplore” process without a Window Title.

    image

    • If you have multiple instances of Internet Explorer open, or multiple tabs inside internet explorer, you can either:
      • Try looking at the CPU consumption of your iexplore.exe processes in Task Manager to see which one is most active
      • Use Process Explorer
        • Find –> “Find Handle or DLL…” (ctrl + F)

        • Search for “coreclr.dll”

        • The “iexplore.exe” process with this dll loaded is the PID you want to attach to

          image

  4. You are now profiling ASP.NET and Silverlight at the same time

Comments

  • Anonymous
    February 23, 2011
    Thanks,But how can I instument a SL app?

  • Anonymous
    February 23, 2011
    Currently Silverlight only supports CPU sampling, so Silvelight applications cannot be instrumented

  • Anonymous
    March 28, 2011
    Hi, I have problem that when I attach to IE (v9) the whole browser crash! After that when I start to analyze the vsp file, there are only data from web (sever) part, the Visual Studio crash too! So what is it? Thank you

  • Anonymous
    April 05, 2011
    @tomas.k have you installed SP1, there were changes in IE9 that require updates in the Visual Studio 2010 SP1 to profile against IE9

  • Anonymous
    April 07, 2011
    Following the instructions for attaching. I have one IE8 running with one tab so I pick the ieprocess without the name. When I do I get a message saying " It is not possible to profile 32-bit and 64-bit at the same time". I am running on Windows 7 Enterprise 64 bit OS, with IE8, VS.NET 2010 SP1 and the latest Silverlight 4 bits. Any ideas how to get around this would be great. Thanks

  • Anonymous
    April 07, 2011
    @Mobbe, are you running your ASP.NET site inside IIS?  If so, it sounds like IIS is running as a 64 bit process, since IE is running as a 32bit process, you'll need to change your IIS threadpool to 32bit in order to profile them at the same time

  • Anonymous
    April 07, 2011
    Thanks, I changed the setting on my AppDomain in IIS to 32 and now I am able to profile.