ANTS Profiler 3.1: source code view and partial classes
Uniwares_AS
Posts: 168
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.
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
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.
Rebuilding does not fix the problem.
Thanks!
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?