ANTS Performance Profiler 7

Profiling an assembly in the Global Assembly Cache (GAC)

When profiling assemblies that are loaded from the Global Assembly Cache, no results may be shown when using the 'profile only methods with source code' setting of the performance profiler. The memory profiler may not show any source code for the methods in a particular assembly loaded from the GAC.

This occurs because the PDB (debugging symbols) file is not saved into the same folder as the assembly being profiled. When the assembly resides in the GAC, this is an additional complication, because the %systemroot%\assembly folder that contains all of the files in the GAC is abstracted by shfusion.dll, which automatically registers assemblies that are dropped onto the folder, making it difficult to add the PDB files into the same folder as the dll. There are two methods to solving this problem.

1. Create a global debugging symbols folder
================================

First, you can create a "global" PDB folder and copy your assemblies there. The disadvantage to this method is that you cannot have multiple version of the same assembly's PDBs in this folder, as you can different versions of the same DLL in the GAC folder. To create a PDB folder, create a folder called "symbols" in the system root folder, and a dll subfolder, for instance:

%systemroot%\symbols\dll

Copy your assemblies' PDB files into this folder, and ANTS Profiler can then resolve the source code location for that assembly installed in your GAC.

2. Manually copy the PDB to the GAC
============================

Secondly, you can copy the PDBs into the same folder as the assembly installed in the GAC. In order to view the GAC folder as a normal folder, you will need to unregister shfusion.dll from a command prompt, by typing and running:

regsvr32 /u %systemroot%\microsoft.net\framework\v2.0.50727\shfusion.dll

Now you may open the GAC folder by using start->run and typing and running %systemroot%\assembly\GAC_MSIL.

Next, double-click on the folder that has the same name as your assembly. Locating the subfolder containing the assembly being profiles is a matter of knowing the version number. There will be a different subfolder for each individual version of the assembly that you have registered into the GAC. Copy the PDB file into the relevant folder.

Don't forget to put the GAC folder into its original state by re-registering shfusion.dll from the command prompt:

regsvr32 %systemroot%\microsoft.net\framework\v2.0.50727\shfusion.dll

Now ANTS Profiler will be able to filter the session to show only methods with source code, even though the assembly resides in the GAC.


Didn't find what you were looking for?