Application skips code while profiling

Use this forum for questions on how to use .NET Memory Profiler and how to analyse memory usage.
Post Reply
Posts: 4
Joined: Thu Oct 05, 2006 5:37 am

Application skips code while profiling

Post by Terry » Thu Oct 05, 2006 6:08 am

Hi there,

Got a strange problem here - some code in our application appears to be skipped when the profiler is attached. I am trying to get snapshots during a long calculation process. First I tried displaying message boxes, then I tried non blocking output coupled with Thread.Sleep. Then I found out about the API and tried to do a snapshot in code. In all cases, it appears that this line of code is simply not executed. Is there anything that the profiler could be doing to suppress this kind of thing? And that doesn't explain why the API didn't work (MemProfiler.IsProfiling returned true). I even went so far as to decompile the code - the instructions are definitely there.

Any ideas?

Cheers in advance,

Andreas Suurkuusk
Posts: 1029
Joined: Wed Mar 02, 2005 7:53 pm

Post by Andreas Suurkuusk » Fri Oct 06, 2006 2:04 pm


The profiler should not cause any code to be skipped. Are you sure that the correct assembly gets loaded? Have you tried to attach to the profiled process using Visual Studio 2005? In the debugger you will be able to see all loaded modules and make sure that the correct module has been loaded. You should also be able to put breakpoints and step in the code, which should give you some information about what's happening.

Note that the dispose tracker will replace Dispose methods and Finalizers, so you will have to disable the dispose tracker to be able to debug those methods.
Best regards,

Andreas Suurkuusk
SciTech Software AB

Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 16 guests