Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/environment-variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ This document lists all environment variables that are understood and handled by
- **Values**: Set to any non-empty value to enable
- **Example**: `VSTEST_DUMP_FORCEPROCDUMP=1`

### VSTEST_DUMP_FORCENETDUMP
### VSTEST_DUMP_FORCENETDUMP (Removed in 18.5, selection of dumper is automatic.)
- **Description**: Forces the use of dotnet-dump for crash dump collection.
- **Values**: Set to any non-empty value to enable
- **Example**: `VSTEST_DUMP_FORCENETDUMP=1`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ public IHangDumper Create(string targetFramework)

EqtTrace.Info($"HangDumperFactory: Creating dumper for {RuntimeInformation.OSDescription} with target framework {targetFramework}.");
var procdumpOverride = Environment.GetEnvironmentVariable("VSTEST_DUMP_FORCEPROCDUMP")?.Trim();
var netdumpOverride = Environment.GetEnvironmentVariable("VSTEST_DUMP_FORCENETDUMP")?.Trim();
EqtTrace.Verbose($"HangDumperFactory: Overrides for dumpers: VSTEST_DUMP_FORCEPROCDUMP={procdumpOverride};VSTEST_DUMP_FORCENETDUMP={netdumpOverride}");
EqtTrace.Verbose($"HangDumperFactory: Overrides for dumpers: VSTEST_DUMP_FORCEPROCDUMP={procdumpOverride}");

var tfm = Framework.FromString(targetFramework);

Expand All @@ -40,20 +39,10 @@ public IHangDumper Create(string targetFramework)
return new ProcDumpDumper();
}

// On some system the interop dumper will thrown AccessViolationException, add an option to force procdump.
var forceUsingNetdump = !netdumpOverride.IsNullOrWhiteSpace() && netdumpOverride != "0";
if (forceUsingNetdump)
if (tfm.FrameworkName == ".NETCoreApp")
{
var isLessThan50 = tfm.FrameworkName == ".NETCoreApp" && Version.Parse(tfm.Version) < Version.Parse("5.0.0.0");
if (!isLessThan50)
{
EqtTrace.Info($"HangDumperFactory: This is Windows on {tfm.FrameworkName} {tfm.Version}, VSTEST_DUMP_FORCENETDUMP={netdumpOverride} is active, forcing use of .NetClientHangDumper");
return new NetClientHangDumper();
}
else
{
EqtTrace.Info($"HangDumperFactory: This is Windows on {tfm.FrameworkName} {tfm.Version}, VSTEST_DUMP_FORCENETDUMP={netdumpOverride} is active, but only applies to .NET 5.0 and newer. Falling back to default hang dumper.");
}
EqtTrace.Info($"HangDumperFactory: This is Windows on {tfm.FrameworkName} {tfm.Version}, returning the standard NETClient library dumper.");
return new NetClientHangDumper();
}

EqtTrace.Info($"HangDumperFactory: This is Windows, returning the default WindowsHangDumper that P/Invokes MiniDumpWriteDump.");
Expand All @@ -62,29 +51,13 @@ public IHangDumper Create(string targetFramework)

if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
{
var isLessThan31 = tfm.FrameworkName == ".NETCoreApp" && Version.Parse(tfm.Version) < Version.Parse("3.1.0.0");
if (isLessThan31)
{
EqtTrace.Info($"HangDumperFactory: This is Linux on netcoreapp2.1, returning SigtrapDumper.");

return new SigtrapDumper();
}

EqtTrace.Info($"HangDumperFactory: This is Linux net6.0 or newer, returning the standard NETClient library dumper.");
EqtTrace.Info($"HangDumperFactory: This is Linux returning the standard NETClient library dumper.");
return new NetClientHangDumper();
}

if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
{
var isLessThan50 = tfm.FrameworkName == ".NETCoreApp" && Version.Parse(tfm.Version) < Version.Parse("5.0.0.0");
if (isLessThan50)
{
EqtTrace.Info($"HangDumperFactory: This is OSX on {targetFramework}, This combination of OS and framework is not supported.");

throw new PlatformNotSupportedException($"Unsupported target framework {targetFramework} on OS {RuntimeInformation.OSDescription}");
}

EqtTrace.Info($"HangDumperFactory: This is OSX on net5.0 or newer, returning the standard NETClient library dumper.");
EqtTrace.Info($"HangDumperFactory: This is OSX returning the standard NETClient library dumper.");
return new NetClientHangDumper();
}

Expand Down

This file was deleted.

Loading