ANTS Profiler box shot

ANTS Profiler

Why can't ANTS Profiler find my source code?

When you profile your application, you may find that ANTS Profiler does not display your source code. This article explains why this happens when you profile a desktop application, Windows service, or COM+ server application.

ANTS Profiler shows source code only when you are profiling a debug build of your application. When you build a debug version of your application, a .pdb (Program Debug Database) file is created. ANTS Profiler uses the .pdb file to locate the source code on your local machine. When you start profiling your application, ANTS Profiler looks for the .pdb file in the folder where the executable or .dll files are located. If the .pdb files are not in the location that ANTS Profiler expects or the source code is not at the location specified in the .pdb file, you will see the messages described below.

No .NET methods have been profiled

When you are profiling performance and you choose to profile Only .NET methods that have source code in the Profiler Project Wizard, and ANTS Profiler cannot find the .pdb file, the message No .NET methods have been profiled is displayed under the results summary.

Error message - No .NET method profiled

In this case, check that you are profiling a debug build and that the .pdb file is in the same folder as the executable or .dll files.

There is no source code available for this method

Error message - No source code available

If ANTS Profiler produces results for a performance profile, but you see the message There is no source code available for this method in the Source code panel, try the following:

  1. Check that you have a .pdb file for each .dll file.

    ANTS Profiler displays source code only when you have the .pdb file. If you do not have the .pdb files for third-party components or Microsoft applications, you can still profile your application by choosing All .NET methods, but ANTS Profiler does not show the source code.

  2. Check the location from which ANTS Profiler is loading assemblies, using the Module file column in the All methods panel.

    This column is not displayed by default; to display the column, right-click any column header, click Choose columns, and then drag the column to the required column header position.

    Make a note of the folder and check that the corresponding .pdb file is in the same folder in Windows Explorer.

  3. For .dll files, if the file is loaded from the GAC (Global Assembly Cache), copy the .pdb file to the GAC.

    A file is loaded from the GAC, if the Module file details are similar to the following:

    c:\WINDOWS\assembly\GAC_MSIL\System.Windows.Forms\2.0.0.0__b77a5c561934e089\System.Windows.Forms.dll

    To copy the .pdb file to the GAC, you need to open a command prompt rather than using Windows Explorer.

    Navigate to the location of the .dll, and then use the copy command, for example:

    cd\WINDOWS\assembly\GAC_MSIL\System.Windows.Forms\2.0.0.0__b77a5c561934e089
    copy c:\MyProject\System.Windows.Forms.pdb

  4. If you have moved your project, ANTS Profiler will also display this message. In this case, rebuild your project, and then start profiling your application again.

There is no source code available for the allocation of this object

Error message - No source code available for the allocation of this object

When you profile memory usage and you see the message There is no source code available for the allocation of this object in the Source code panel, try the following:

  1. Check that you have a .pdb file for each .dll file.

    ANTS Profiler displays source code only when you have the .pdb file.

  2. Check the location from which ANTS Profiler is loading assemblies in the Call stack panel.

    This panel is not displayed by default; to display the panel, on the View menu, click Call stack.

    Make a note of the folder and check that the corresponding .pdb file is in the same folder in Windows Explorer.

Original source code not found at (path)

When ANTS Profiler cannot find the source code at the location specified in the .pdb file, a dialog box is displayed for you to browse for the source code files.

Original source code not found

This happens when you profile a debug build, but you do not have the source code files, for example if you take a debug build from your build server. In this case, if you have the source code files, you can specify the location of the source code file to continue working with the results.