Page 1 of 1

Profiling Outlook AddIn with API

Posted: Mon Jan 16, 2017 5:04 pm
by BuchnerA27
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!!

Re: Profiling Outlook AddIn with API

Posted: Tue Jan 17, 2017 2:23 pm
by Andreas Suurkuusk
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.

Re: Profiling Outlook AddIn with API

Posted: Fri Jan 20, 2017 11:26 am
by BuchnerA27
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 :-)