Hi,
After installing NCrunch, bunch of my existing MSTest tests failed. Upon investigation, I found most of the test failed as the value of Thread.CurrentPrincipal.Identity.Name in the below product code is getting set to empty whereas it is set to correct value in domain\alias format when run under MSTest. As the default value for ownerAlias is empty, username becomes empty and hit the exception in the next line.
var username = String.IsNullOrWhiteSpace(ownerAlias) ? Thread.CurrentPrincipal.Identity.Name : ownerAlias;
var xx = Thread.CurrentPrincipal.Identity.Name; // This is to verify the value
ExceptionUtility.ThrowIfArgumentNullOrEmpty(username, "Could not find current username.");
Wondering, if this is because NCrunch uses its own process to run the test, so doesn't have a valid CurrentPrincipal value!
I have tried changing the property "Engine hosting strategy = HostInsideIDE (the default was x64SatelliteProcess)" under configuration with no success.
Has anyone encountered similar issue before and any suggestion on how to tackle this?
Appreciate your help.