As we can see via the TestResults of MSTest the memprofiler is running but cannot detect any objects in the target application. Instead of an exception message or any other usefull logging message the memprofiler returns all assert checks with true, which is in fact wrong.
The CodedUiTest is started correctly as I can see the target app executing successfully (UITest). Also we did the custom configuration on the UITests and Target Application in the App.config for <gcConcurrent enabled="false"/> and <supportRuntime version="v4.0.30319" />
Also we start MSTest.exe with the noisolation option:
/noisolation /testcontainer:Company.UITests.ProjectA.Tests.dll /test:CreateDocument /testsettings:Local.testsettings
Moreover the option for [Suspend thread until memory leak is handled] is already enabled.
In addition we added some Thread.Sleeps() into the UI Test before and after doing the asserts to give memprofiler more time to finish a snapshot somehow. But this also did not help. Switching from FastSnapShot to FullSnapShot had also no effect. MemAssertions still return always true.
Coded UI Test:
public void CreateDocument()
MemSnapShot refSnapShot = MemProfiler.FullSnapShot();
Console.WriteLine("Is profiling: " + MemProfiler.IsProfiling);
AssertionsDefinition ad = new AssertionsDefinition();
ad.MaxInstances("Company.Presentation.Views.WelcomeView", true, 0);
ad.MaxInstances("Company.Domain.DocumentRoot", true, 0);
bool assertResult = MemAssertion.Assert(refSnapShot, ad);
Console.WriteLine("memtests were: " + assertResult);
If that's the case, the UITest process is not being profiled and the UI class instances (e.g. "Company.Presentation.Views.WelcomeView" and "Company.Domain.DocumentRoot") are not created in the profiled process. Therefore the assertions will not fail (if the specified type is not found, the NoInstances and MaxInstances assertions will always succeed*).
To check that the UI class instances are correctly GCed, you need to run the "UITest" process under the profiler, instead of "MSTest". Unfortunately, this also requires that you perform the assertions within the "UITest" process, which is probably not what you want.
* Even though it is correct that there are no instances of a type that cannot be found, it is likely that this is not intentional. If the type is missing, you would probably want to log it as an error. For a future version of the profiler, we will consider adding an option to throw an exception or raise an event if the assertion includes missing types.
SciTech Software AB
Users browsing this forum: No registered users and 43 guests