ANTS not including timings when calling COM objects

I am using ANTS 2.0 to profile a .NET application that makes calls into COM methods (for Microsoft Word). Obviously I don't expect ANTS to be able to tell me the times for what is going on once it crosses over into COM, but for some reason it doesn't accurately report how long the .NET methods that make the COM calls take to execute.

For example:

MyFunc() calls (through COM interop) a Word function that takes 10 secs to execute.

ANTS reports that MyFunc took like 0.002 seconds to execute. It looks like this time is from the method entry point to the time it crosses the COM interop code, when in reality, it should tell me how long MyFunc() took to run (from entry to exit).

Is there possibly a setting I can enable where ANTS will tell me the total elapsed time the function takes to execute regardless of what is being called inside the .NET method?


  • Brian DonahueBrian Donahue Posts: 6,590 New member
    Hello Webview,

    I have a suspicion that this has something to do with the threading model of the COM component that you had called. Like the method that you had called in the COM object had kicked off a thread and returned a result back to the Interop dll right away. Could that be the case?
  • It doesn't appear to be multi-threaded in that the method call is synchronous and will wait until the interop code returns. I wonder if the nature of COM messaging (way down deep it uses the old windows message--i.e. wndprocs and the like). I wonder if this is affecting it?

    Should ANTS handle profiling COM interop (or any interop) for that matter?
  • Hi there,

    we have fixed the timings for COM libraries in v2.1 of the product. If you are interested in having a look at the beta of v2.1 just send a quick mail to [email protected]


    Tom Harris

    Red Gate Software Ltd
  • Brian DonahueBrian Donahue Posts: 6,590 New member
    The COM timings have been corrected in version 2.5, which is now publicly available. Although ANTS Profiler still cannot profile managed code, the time spent in Interop methods is quite a bit more accurate because it will show the amount of time spent in the COM layer before returning.
  • Hi.
    Well - I use version 2.6.0 build 62
    and I still get a very long time profiling a .NET application using a Word.Interop.

    About 10 sec. each time - and without Ants using my own custom made loggning this takes under 1 sec!

    Any ideas?

    Below is listet the code which take approx. 10 sec. to profile.
    (I'm using Interop.Word.dll verison and
    Interop.Office.dll version

    mWordApp = new Application();
    mWordApp.Visible = false;
    mWordApp.Options.CheckSpellingAsYouType = false;
    mWordApp.Options.CheckGrammarWithSpelling = false;
    mWordApp.Options.CheckGrammarAsYouType = false;
    mWordApp.Options.CheckHangulEndings = false;

    best regards Bo.
Sign In or Register to comment.