Skip to content

Commit

Permalink
Optionally force procdump (#2531)
Browse files Browse the repository at this point in the history
* Optionally force usage of ProcDump

* Merge
  • Loading branch information
nohwnd committed Aug 21, 2020
1 parent 30d13b3 commit b2a99b1
Showing 1 changed file with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,20 @@ public ICrashDumper Create(string targetFramework)
return new ProcDumpCrashDumper();
}

// On net5.0 we don't have the capability to crash dump on exit, which is useful in rare cases
// like when user exits the testhost process with a random exit code, adding this evn variable
// to force using procdump. This relies on netclient dumper actualy doing all it's work in blame collector
// where it sets all the environment variables, so in effect we will have two crash dumpers active at the same time.
// This proven to be working okay while net5.0 could not create dumps from Task.Run, and I was using this same technique
// to get dump of testhost. This needs PROCDUMP_PATH set to directory with procdump.exe, or having it in path.
var procdumpOverride = Environment.GetEnvironmentVariable("VSTEST_DUMP_FORCEPROCDUMP")?.Trim();
var forceUsingProcdump = string.IsNullOrWhiteSpace(procdumpOverride) && procdumpOverride != "0";
if (forceUsingProcdump)
{
EqtTrace.Info($"CrashDumperFactory: This is Windows on {targetFramework}. Forcing the use of ProcDumpCrashDumper that uses ProcDump utility, via VSTEST_DUMP_FORCEPROCDUMP={procdumpOverride}.");
return new ProcDumpCrashDumper();
}

EqtTrace.Info($"CrashDumperFactory: This is Windows on {targetFramework}, returning the .NETClient dumper which uses env variables to collect crashdumps of testhost and any child process.");
return new NetClientCrashDumper();
}
Expand Down

0 comments on commit b2a99b1

Please sign in to comment.