Page 1 of 1

Application skips code while profiling

Posted: Thu Oct 05, 2006 6:08 am
by Terry
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,

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

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.