Options

ANTS Profiler 3.1: source code view and partial classes

It seems that the profiles has some problems to show the correct location of an object if the class is spread over multiple files using partial classes.
I have a case where the ctor is in a file with the class name, but i have various other files which contain function groups. Naming scheme is like: classname.functiongroup.cs -> e.g. myclass.menuhandlers.cs
In this case the ctor is in myclass.cs, but the profiler shows me the myclass.designer.cs file, although the object in question is created in the ctor.

Comments

  • Options
    Brian DonahueBrian Donahue Posts: 6,590 Bronze 1
    Hello,

    Thanks for your post. It's hard to imagine what you're seeing without access to your source code, but I think it could be that you're looking at ANTS memory profiler's all objects tab and getting an unexpected result in the source code panel.

    Because the source code will show a particular line of code where an instance of the object highlighted in the all objects panel is created, the line of code shown should be the line where the constructor is called, rather than the constructor itself, for instance, if I use the example ShapePainter application and highlight a SolidBrush object, I am taken to a line of code like g.FillPolygon(new SolidBrush(this.m_Color), this.m_Triangle); rather than SolidBrush..ctor.

    If you're actually being shown the wrong source code file, then maybe rebuilding the project would help. If the debug symbols files are out-of-date since you had moved some of the source code to a different file, then this could cause this sort of problem, since ANTS Profiler relies on the information in the PDB file to locate source code and lines of code within them.
  • Options
    No, no, I am really taken to the wrong source file. The file shows does not even create a single instance of the questionable object.
    Rebuilding does not fix the problem.
  • Options
    Brian DonahueBrian Donahue Posts: 6,590 Bronze 1
    What type of project is it? A web application?
    Thanks!
  • Options
    No, is a windows forms desktop application, heavily database dependant, C# 2.0, .Net 2.0, using VS2005 SP2.
  • Options
    Brian DonahueBrian Donahue Posts: 6,590 Bronze 1
    Hi,

    The ANTS Profiler source code resolution is entirely dependent on the information inside the PDB files. I can't find any other reason why this wouldn't work, partial classes or not...

    Can you look in the folders where the assemblies reside and verify the last modified dates of the assemblies and the PDBs are roughly the same date and time?
  • Options
    Will verify, but i guess so, since usually we do a rebuild all before testing. I keep you informed as we go.
Sign In or Register to comment.