Profiling Outlook AddIn with API

Use this forum for questions on how to use .NET Memory Profiler and how to analyse memory usage.

Moderator: SciTech Software

Profiling Outlook AddIn with API

Postby BuchnerA27 » Mon Jan 16, 2017 5:04 pm

Hi Support-Team,

currently I´m evaluating your memory profiler for our dev-team.

Our main product is an outlook add-in. We´d like to use your API to create unit tests that automatically tests the memory usage of our application. At the moment we´re stuck to get the API in the tests working (MemProfiler.IsProfiling always returns false).
We found out that we have to start the tests from your profiler and also outlook has to run via the profiler. So what we did is:
- Start the tests via VS when "Run tests under profiler" is active
- Outlook is started via our TestInitializer

But it always won´t work. Do you have any guidance how to profile an outlook add-in?

I found some pretty old threads that there we´re plans to integrate a function like "MemProfiler.AttachToProcess()", but I can´t find anything like that. Is there any progress on this topic or is this cancelled?

Thanks in advance!!
Posts: 2
Joined: Mon Jan 16, 2017 9:03 am

Re: Profiling Outlook AddIn with API

Postby Andreas Suurkuusk » Tue Jan 17, 2017 2:23 pm

As you have noticed, the tested process must be run under the profiler, otherwise the MemProfiler.IsProfiling property will return false. The "Run tests under profiler" is designed to profile tests running under the Visual Studio test engine. Profiling processes spawned by the test initializer is not something we have designed the test runner to handle. However, I still think this is something that should work. You say that it doesn't always work, so I assume that it at least partially works. Are you sure that newly started Outlook process is always used? Maybe it detects a running instance and switches to that one instead?

The "Run tests under profiler" feature makes it easier to run unit tests, but in your case it may be better to use the "Profile application" command and profile the "vstest.console.exe" program instead.

Anyway, I will try to create an Outlook add-in and see if I can come up with a suggestion on the best way to profile Outlook unit tests.

The MemProfiler.AttachToProcess API is not cancelled, but there's no immediately plans to implement it. When attaching to a process, you will get much less information, which will make the memory assertions less useful. For example, it will not be possible to distinguish between old and new instances.
Best regards,

Andreas Suurkuusk
SciTech Software AB
Andreas Suurkuusk
Posts: 993
Joined: Wed Mar 02, 2005 7:53 pm
Location: Sweden

Re: Profiling Outlook AddIn with API

Postby BuchnerA27 » Fri Jan 20, 2017 11:26 am

Hello Andreas,

sorry for the late reply, there was a bit other stuff to do :)
Thanks for these information. We´re now able to get to profiler active, but it still doesn´t work completly.

I now start "vstest.console.exe" via Profile Application and outlook get´s started via our intitializer. MemProfiler.IsProfiling is also returning true. But we´re still not able to get the Assertion Fail when some of our own classes are still in use. I created some screenshot to explain that and will send them to you via mail (don´t wanna have them public).

Hopefully you can help us here :-)
Posts: 2
Joined: Mon Jan 16, 2017 9:03 am

Return to Using .NET Memory Profiler

Who is online

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

SciTech Software logo

© Copyright 2001-2016. SciTech Software AB
All rights reserved.

SciTech Software AB
Kartvägen 21
SE-175 46 Järfälla


Telephone: +46-706868081