I have used the builtin sampling-based performance profiler of VS 2010 successfully in the past. Sometimes the highlighted code in the code window was off by a couple of lines. That might have been due to code optimization, which the profiler is said not to handle very well. Other than that, it worked for me (in contrast to the instrumenting variant)
However, this time the results are just plain wrong. For instance, there is a single line in my code (a call to another method that results in a DB query) that accounts for 40% of the total run time, and which I found by the "comment out code bisection" method.
The sampling profiler of VS2012 (and VS2010, I double checked) however tells me the method accounts for something like 1% (inclusive), i.e. it does not even show up in the report summary and I have to search to the bottom of the detail tables to find it. I cranked up the sampling frequency just in case, to no avail.
What could throw the profiler this far off?
I am profiling a .net 3.5 based project, with a fair number of dlls. I tried profiling in both 'Release' and 'Debug' mode. No substantial difference.