Enable createdump/dotnet-dump testing on MacOS (#1533)
authorMike McLaughlin <mikem@microsoft.com>
Fri, 18 Sep 2020 06:20:16 +0000 (23:20 -0700)
committerGitHub <noreply@github.com>
Fri, 18 Sep 2020 06:20:16 +0000 (23:20 -0700)
Enable createdump/dotnet-dump testing on MacOS

Add COMPlus_DbgEnableElfDumpOnMacOS env var to enable ELF MacOS dumps

Install SDK and runtimes into ".dotnet-test" so the new SDKs can be used independent of what Arcade requires.

Change SOS.UnitTests to netcoreapp3.1

Add error message about heap state to pe command

Add net5.0 to SOS debuggees and change config files to use them

Update SDK in global.json

Fix WebApp3 debuggee on MacOS

Use SDK version 5.0.100-rc.1.20454.5

Add --diag to dotnet-dump collect testing

31 files changed:
.gitignore
eng/CleanupPrivateBuild.csproj
eng/CreateVersionFile.csproj
eng/InstallRuntimes.proj
eng/dotnet-install.ps1 [new file with mode: 0644]
eng/dotnet-install.sh [new file with mode: 0644]
global.json
src/Microsoft.Diagnostics.TestHelpers/DotNetBuildDebuggeeTestStep.cs
src/Microsoft.Diagnostics.TestHelpers/TestConfiguration.cs
src/SOS/SOS.UnitTests/ConfigFiles/Unix/Debugger.Tests.Config.txt
src/SOS/SOS.UnitTests/ConfigFiles/Windows/Debugger.Tests.Config.txt
src/SOS/SOS.UnitTests/Debuggees/DesktopClrHost/CMakeLists.txt
src/SOS/SOS.UnitTests/Debuggees/DivZero/DivZero.csproj
src/SOS/SOS.UnitTests/Debuggees/GCPOH/GCPOH.csproj
src/SOS/SOS.UnitTests/Debuggees/GCWhere/GCWhere.csproj
src/SOS/SOS.UnitTests/Debuggees/LineNums/LineNums.csproj
src/SOS/SOS.UnitTests/Debuggees/NestedExceptionTest/NestedExceptionTest.csproj
src/SOS/SOS.UnitTests/Debuggees/Overflow/Overflow.csproj
src/SOS/SOS.UnitTests/Debuggees/ReflectionTest/ReflectionTest.csproj
src/SOS/SOS.UnitTests/Debuggees/SimpleThrow/SimpleThrow.csproj
src/SOS/SOS.UnitTests/Debuggees/SymbolTestApp/SymbolTestApp/SymbolTestApp.csproj
src/SOS/SOS.UnitTests/Debuggees/SymbolTestApp/SymbolTestDll/SymbolTestDll.csproj
src/SOS/SOS.UnitTests/Debuggees/TaskNestedException/RandomUserLibrary/RandomUserLibrary.csproj
src/SOS/SOS.UnitTests/Debuggees/TaskNestedException/TaskNestedException/TaskNestedException.csproj
src/SOS/SOS.UnitTests/Debuggees/WebApp3/Program.cs
src/SOS/SOS.UnitTests/Debuggees/WebApp3/WebApp3.csproj
src/SOS/SOS.UnitTests/Debuggees/WebApp3/testCert.pfx [new file with mode: 0644]
src/SOS/SOS.UnitTests/SOS.UnitTests.csproj
src/SOS/SOS.UnitTests/SOS.cs
src/SOS/SOS.UnitTests/SOSRunner.cs
src/SOS/Strike/strike.cpp

index 70a02e897482847ae9a7b97f0edeed5fa64e24c3..484c88f0d9cebb124644a079d95dcbf0f1381fe0 100644 (file)
@@ -17,6 +17,7 @@
 [Pp]ackages/
 x64/
 .dotnet/
+.dotnet-test/
 .packages/
 .tools/
 
index 83118ceba44f8e4e9d48c3979263b2080071aa81..5ef592ad86732c62c6e9f083b609f09b048ec185 100644 (file)
@@ -1,6 +1,6 @@
 <Project Sdk="Microsoft.NET.Sdk">
   <PropertyGroup>
-    <TargetFramework>netcoreapp2.0</TargetFramework>
+    <TargetFramework>netcoreapp2.1</TargetFramework>
   </PropertyGroup>
   
   <Import Project="$(RepositoryEngineeringDir)\InstallRuntimes.proj" />
index d25e93167fc5a86440829ca109d44240fc0fb08d..6866b66ad573f6109656057e64cac51ef919752d 100644 (file)
@@ -1,7 +1,7 @@
 <!-- All Rights Reserved. Licensed to the .NET Foundation under one or more agreements. The .NET Foundation licenses this file to you under the MIT license. See the LICENSE file in the project root for more information. -->
 <Project Sdk="Microsoft.NET.Sdk">
   <PropertyGroup>
-    <TargetFramework>netcoreapp2.0</TargetFramework>
+    <TargetFramework>netcoreapp2.1</TargetFramework>
   </PropertyGroup>
 
   <Target Name="GenerateVersionFiles" DependsOnTargets="GenerateVersionHeader;GenerateVersionSourceFile" />
index a62f0c72d57aaf33935a6af378a60e192c405966..33cc884e7a87b5ade4adb10e0037f2786b5e97c5 100644 (file)
      
      From Versions.props:
 
+     $(MicrosoftDotnetSdkInternalVersion) - .NET SDK to use for testing
+
      $(MicrosoftNETCoreAppVersion)   $(MicrosoftAspNetCoreAppRefVersion) - latest dotnet runtime/aspnetcore version to install/test
      $(MicrosoftNETCoreApp31Version) $(MicrosoftAspNetCoreApp31Version)  - 3.1 version
      $(MicrosoftNETCoreApp21Version) $(MicrosoftAspNetCoreApp21Version)  - 2.1 version
 
      From Arcade:
 
-     $(DotNetRoot) - the SDK/runtime installation root
+     $(RepoRoot) - the root of the diagnostics repo
      $(RepositoryEngineeringDir) - the "eng" directory
      $(VersionsPropsPath) - path of Versions.props
   -->
   </PropertyGroup>
 
   <PropertyGroup Condition="'$(BuildArch)' != 'x86'">
-    <DotNetInstallRoot>$(DotNetRoot)</DotNetInstallRoot>
+    <DotNetInstallRoot>$(RepoRoot).dotnet-test\</DotNetInstallRoot>
     <RegistryRoot>HKEY_LOCAL_MACHINE\SOFTWARE</RegistryRoot>
   </PropertyGroup>
 
   <PropertyGroup Condition="'$(BuildArch)' == 'x86'">
-    <DotNetInstallRoot>$(DotNetRoot)x86\</DotNetInstallRoot>
+    <DotNetInstallRoot>$(RepoRoot).dotnet-test\x86\</DotNetInstallRoot>
     <RegistryRoot>HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node</RegistryRoot>
   </PropertyGroup>
 
   <PropertyGroup>
-    <CommonInstallArgs>-architecture $(BuildArch)</CommonInstallArgs>
+    <CommonInstallArgs>-NoPath -SkipNonVersionedFiles -Architecture $(BuildArch) -InstallDir $(DotNetInstallRoot)</CommonInstallArgs>
     <DotNetInstallDir>$(DotNetInstallRoot.Replace("\", "\\"))shared\\Microsoft.NETCore.App\\$(MicrosoftNETCoreAppVersion)\\</DotNetInstallDir>
     <TestConfigFileName>$(DotNetInstallRoot)Debugger.Tests.Versions.txt</TestConfigFileName>
     <AddRegeditFileName>$(DotNetInstallRoot)AddPrivateTesting.reg</AddRegeditFileName>
     <When Condition="$([MSBuild]::IsOsPlatform(Windows))">
       <PropertyGroup>
         <PowershellWrapper>powershell -NonInteractive -ExecutionPolicy ByPass -NoProfile -command</PowershellWrapper>
-        <DotnetInstallScriptCmd>'$(RepositoryEngineeringDir)common\dotnet-install.ps1'</DotnetInstallScriptCmd>
+        <DotnetInstallScriptCmd>'$(RepositoryEngineeringDir)\dotnet-install.ps1'</DotnetInstallScriptCmd>
       </PropertyGroup>
     </When>
     <Otherwise>
       <PropertyGroup>
-        <DotnetInstallScriptCmd>$(RepositoryEngineeringDir)common/dotnet-install.sh</DotnetInstallScriptCmd>
+        <DotnetInstallScriptCmd>$(RepositoryEngineeringDir)/dotnet-install.sh</DotnetInstallScriptCmd>
       </PropertyGroup>
     </Otherwise>
   </Choose>
           Condition="$([MSBuild]::IsOsPlatform(Windows))"
           Inputs="$(VersionsPropsPath)" Outputs="$(TestConfigFileName)">
 
-    <Exec Command="$(PowershellWrapper) &quot;&amp; { &amp;$(DotnetInstallScriptCmd) $(CommonInstallArgs) %(TestVersions.ExtraInstallArgs) -version %(TestVersions.RuntimeVersion) -runtime dotnet }&quot;"
+    <Exec Command="$(PowershellWrapper) &quot;&amp; { &amp;$(DotnetInstallScriptCmd) $(CommonInstallArgs) -Version $(MicrosoftDotnetSdkInternalVersion) }&quot;" />
+
+    <Exec Command="$(PowershellWrapper) &quot;&amp; { &amp;$(DotnetInstallScriptCmd) $(CommonInstallArgs) %(TestVersions.ExtraInstallArgs) -Version %(TestVersions.RuntimeVersion) -Runtime dotnet }&quot;"
           Condition="'%(TestVersions.RuntimeVersion)' != ''" />
 
-    <Exec Command="$(PowershellWrapper) &quot;&amp; { &amp;$(DotnetInstallScriptCmd) $(CommonInstallArgs) %(TestVersions.ExtraInstallArgs) -version %(TestVersions.AspNetVersion) -runtime aspnetcore }&quot;"
+    <Exec Command="$(PowershellWrapper) &quot;&amp; { &amp;$(DotnetInstallScriptCmd) $(CommonInstallArgs) %(TestVersions.ExtraInstallArgs) -Version %(TestVersions.AspNetVersion) -Runtime aspnetcore }&quot;"
           Condition="'%(TestVersions.AspNetVersion)' != ''" />
   </Target>
 
           Condition="!$([MSBuild]::IsOsPlatform(Windows))"
           Inputs="$(VersionsPropsPath)" Outputs="$(TestConfigFileName)">
 
-    <Exec Command="$(DotnetInstallScriptCmd) $(CommonInstallArgs) %(TestVersions.ExtraInstallArgs) -version %(TestVersions.RuntimeVersion) -runtime dotnet"
+    <Exec Command="bash $(DotnetInstallScriptCmd) $(CommonInstallArgs) -Version $(MicrosoftDotnetSdkInternalVersion)"
+          IgnoreStandardErrorWarningFormat="true" />
+
+    <Exec Command="bash $(DotnetInstallScriptCmd) $(CommonInstallArgs) %(TestVersions.ExtraInstallArgs) -Version %(TestVersions.RuntimeVersion) -Runtime dotnet"
           IgnoreStandardErrorWarningFormat="true"
           Condition="'%(TestVersions.RuntimeVersion)' != ''" />
 
-    <Exec Command="$(DotnetInstallScriptCmd) $(CommonInstallArgs) %(TestVersions.ExtraInstallArgs) -version %(TestVersions.AspNetVersion) -runtime aspnetcore"
+    <Exec Command="bash $(DotnetInstallScriptCmd) $(CommonInstallArgs) %(TestVersions.ExtraInstallArgs) -Version %(TestVersions.AspNetVersion) -Runtime aspnetcore"
           IgnoreStandardErrorWarningFormat="true"
           Condition="'%(TestVersions.AspNetVersion)' != ''" />
    </Target>
diff --git a/eng/dotnet-install.ps1 b/eng/dotnet-install.ps1
new file mode 100644 (file)
index 0000000..7adde78
--- /dev/null
@@ -0,0 +1,29 @@
+[CmdletBinding(PositionalBinding=$false)]
+Param(
+  [string] $InstallDir="<auto>",
+  [string] $Architecture="<auto>",
+  [string] $Version = "Latest",
+  [string] $Runtime,
+  [string] $RuntimeSourceFeed = "",
+  [string] $RuntimeSourceFeedKey = "",
+  [switch] $SkipNonVersionedFiles,
+  [switch] $NoPath
+)
+
+. $PSScriptRoot\common\tools.ps1
+
+try {
+  if ($Runtime) {
+    InstallDotNet $InstallDir $Version $Architecture $Runtime $SkipNonVersionedFiles -RuntimeSourceFeed $RuntimeSourceFeed -RuntimeSourceFeedKey $RuntimeSourceFeedKey
+  }
+  else {
+    InstallDotNetSdk $InstallDir $Version $Architecture
+  }
+}
+catch {
+  Write-Host $_.ScriptStackTrace
+  Write-PipelineTelemetryError -Category 'InitializeToolset' -Message $_
+  ExitWithExitCode 1
+}
+
+ExitWithExitCode 0
diff --git a/eng/dotnet-install.sh b/eng/dotnet-install.sh
new file mode 100644 (file)
index 0000000..9ba628d
--- /dev/null
@@ -0,0 +1,75 @@
+#!/usr/bin/env bash
+
+source="${BASH_SOURCE[0]}"
+# resolve $source until the file is no longer a symlink
+while [[ -h "$source" ]]; do
+  scriptroot="$( cd -P "$( dirname "$source" )" && pwd )"
+  source="$(readlink "$source")"
+  # if $source was a relative symlink, we need to resolve it relative to the path where the
+  # symlink file was located
+  [[ $source != /* ]] && source="$scriptroot/$source"
+done
+scriptroot="$( cd -P "$( dirname "$source" )" && pwd )"
+
+. "$scriptroot/common/tools.sh"
+
+install_dir="<auto>"
+architecture="<auto>"
+version="Latest"
+runtime=""
+runtimeSourceFeed=""
+runtimeSourceFeedKey=""
+skip_non_versioned_files=false
+
+while [[ $# > 0 ]]; do
+  opt="$(echo "$1" | awk '{print tolower($0)}')"
+  case "$opt" in
+    -i|--install-dir|-[Ii]nstall[Dd]ir)
+      shift
+      install_dir="$1"
+      ;;
+    -v|--version|-[Vv]ersion)
+      shift
+      version="$1"
+      ;;
+    --arch|--architecture|-[Aa]rch|-[Aa]rchitecture)
+      shift
+      architecture="$1"
+      ;;
+    --runtime|-[Rr]untime)
+      shift
+      runtime="$1"
+      ;;
+    -runtimesourcefeed)
+      shift
+      runtimeSourceFeed="$1"
+      ;;
+    -runtimesourcefeedkey)
+      shift
+      runtimeSourceFeedKey="$1"
+      ;;
+    --skip-non-versioned-files|-[Ss]kip[Nn]on[Vv]ersioned[Ff]iles)
+      skip_non_versioned_files=true
+      ;;
+    --no-path|-[Nn]o[Pp]ath)
+      ;;
+    *)
+      Write-PipelineTelemetryError -Category 'Build' -Message "Invalid argument: $1"
+      exit 1
+      ;;
+  esac
+  shift
+done
+
+if [[ "$runtime" != "" ]]; then
+  InstallDotNet "$install_dir" "$version" "$architecture" $runtime $skip_non_versioned_files $runtimeSourceFeed $runtimeSourceFeedKey
+else
+  InstallDotNetSdk "$install_dir" "$version" "$architecture"
+fi
+
+if [[ $exit_code != 0 ]]; then
+  Write-PipelineTelemetryError -Category 'InitializeToolset' -Message "dotnet-install.sh failed (exit code '$exit_code')." >&2
+  ExitWithExitCode $exit_code
+fi
+
+ExitWithExitCode 0
index 49aaaea3c8cfd2c0cdb69dcf4d3892b7f04a49eb..66ee323fa1d96ca142c388497c663dfe53b4ddb6 100644 (file)
@@ -1,6 +1,6 @@
 {
   "tools": {
-    "dotnet": "5.0.100-preview.6.20310.4",
+    "dotnet": "5.0.100-rc.1.20452.10",
     "runtimes": {
       "dotnet/x64": [
         "$(MicrosoftNETCoreApp31Version)",
index eba69c5c1b42aa76d85f215b0947e3d836570459..58f941e4cc140d53147381c2ae53e81134e50569 100644 (file)
@@ -186,6 +186,7 @@ namespace Microsoft.Diagnostics.TestHelpers
             {
                 args += extraArgs;
             }
+            output.WriteLine("Launching {0} {1}", DotNetToolPath, args);
             ProcessRunner runner = new ProcessRunner(DotNetToolPath, args).
                       WithWorkingDirectory(DebuggeeSolutionDirPath).
                       WithLog(output).
@@ -226,6 +227,7 @@ namespace Microsoft.Diagnostics.TestHelpers
             AssertDebuggeeProjectFileExists(output);
             AssertDebuggeeAssetsFileExists(output);
 
+            output.WriteLine("Launching {0} {1}", DotNetToolPath, dotnetArgs);
             ProcessRunner runner = new ProcessRunner(DotNetToolPath, dotnetArgs).
                       WithWorkingDirectory(DebuggeeProjectDirPath).
                       WithLog(output).
index 4b03031df373a05c6a4629dccf3c7810b360d183..f78930fe0a49a74d01e58c332a100b4c2cc70478 100644 (file)
@@ -740,6 +740,7 @@ namespace Microsoft.Diagnostics.TestHelpers
             get
             {
                 return OS.Kind == OSKind.Linux && IsNETCore && RuntimeFrameworkVersionMajor >= 2 ||
+                       OS.Kind == OSKind.OSX && IsNETCore && RuntimeFrameworkVersionMajor >= 5 ||
                        OS.Kind == OSKind.Windows && IsNETCore && RuntimeFrameworkVersionMajor >= 5;
             }
         }
index 3017810ad7e78a58bd0adfdbad0ffe0ba861c45f..d5e5ec11cbbd119aca6e9604b1633d1e94b224d3 100644 (file)
@@ -9,7 +9,7 @@
 
 <Configuration>
   <RepoRootDir>../../../../..</RepoRootDir>
-  <DotNetRoot>$(RepoRootDir)/.dotnet</DotNetRoot>
+  <DotNetRoot>$(RepoRootDir)/.dotnet-test</DotNetRoot>
 
   <Import ConfigFile="Debugger.Tests.Common.txt" />
   <Import ConfigFile="$(DotNetRoot)/Debugger.Tests.Versions.txt" />
@@ -29,7 +29,8 @@
   <TestWebApp3 Condition="'$(InternalReleaseTesting)' == 'true'">false</TestWebApp3>
 
   <!-- Build the debuggee for this framework version but run it on latest -->
-  <BuildProjectFrameworkLatest Condition="StartsWith('$(RuntimeVersionLatest)', '5')">netcoreapp3.1</BuildProjectFrameworkLatest>
+  <BuildProjectFrameworkLatest Condition="StartsWith('$(RuntimeVersionLatest)', '6')">net5.0</BuildProjectFrameworkLatest>
+  <BuildProjectFrameworkLatest Condition="StartsWith('$(RuntimeVersionLatest)', '5')">net5.0</BuildProjectFrameworkLatest>
   <BuildProjectFrameworkLatest Condition="StartsWith('$(RuntimeVersionLatest)', '3.1')">netcoreapp3.1</BuildProjectFrameworkLatest>
   <BuildProjectFrameworkLatest Condition="StartsWith('$(RuntimeVersionLatest)', '2.1')">netcoreapp2.1</BuildProjectFrameworkLatest>
 
   <Options>
     <Option Condition="$(OS) == Linux">
       <SOSPath>$(InstallDir)/libsosplugin.so</SOSPath>
-      <DotNetDumpHost>$(DotNetRoot)/dotnet</DotNetDumpHost>
-      <DotNetDumpPath>$(RootBinDir)/bin/dotnet-dump/$(TargetConfiguration)/netcoreapp2.1/publish/dotnet-dump.dll</DotNetDumpPath>
-      <DebuggeeDumpOutputRootDir>$(DumpDir)/$(TestProduct)/$(RuntimeFrameworkVersion)/$(BuildProjectFramework)</DebuggeeDumpOutputRootDir>
-      <DebuggeeDumpInputRootDir>$(DebuggeeDumpOutputRootDir)</DebuggeeDumpInputRootDir>
     </Option>
     <Option Condition="$(OS) == OSX">
       <SOSPath>$(InstallDir)/libsosplugin.dylib</SOSPath>
-      <!-- Dump testing is disabled on macOS. gdb can't run processes because it needs to be code signed and lldb on macOS's "process save-core" is too slow -->
     </Option>
   </Options>
 
+  <DotNetDumpHost>$(DotNetRoot)/dotnet</DotNetDumpHost>
+  <DotNetDumpPath>$(RootBinDir)/bin/dotnet-dump/$(TargetConfiguration)/netcoreapp2.1/publish/dotnet-dump.dll</DotNetDumpPath>
+  <DebuggeeDumpOutputRootDir>$(DumpDir)/$(TestProduct)/$(RuntimeFrameworkVersion)/$(BuildProjectFramework)</DebuggeeDumpOutputRootDir>
+  <DebuggeeDumpInputRootDir>$(DebuggeeDumpOutputRootDir)</DebuggeeDumpInputRootDir>
+
 </Configuration>
index 1e16f37d26ecf54d11d3d333536212f9b8d6e0a8..886f7ff8f5a5b72a75893598d7ca08a576f8fd49 100644 (file)
@@ -9,8 +9,8 @@
 
 <Configuration>
   <RepoRootDir>..\..\..\..\..</RepoRootDir>
-  <DotNetRoot Condition="'$(TargetArchitecture)' != 'x86'">$(RepoRootDir)\.dotnet</DotNetRoot>
-  <DotNetRoot Condition="'$(TargetArchitecture)' == 'x86'">$(RepoRootDir)\.dotnet\x86</DotNetRoot>
+  <DotNetRoot Condition="'$(TargetArchitecture)' != 'x86'">$(RepoRootDir)\.dotnet-test</DotNetRoot>
+  <DotNetRoot Condition="'$(TargetArchitecture)' == 'x86'">$(RepoRootDir)\.dotnet-test\x86</DotNetRoot>
 
   <Import ConfigFile="Debugger.Tests.Common.txt" />
   <Import ConfigFile="$(DotNetRoot)\Debugger.Tests.Versions.txt" />
@@ -20,7 +20,7 @@
   <InstallDir>$(RootBinDir)\bin\Windows_NT.$(TargetArchitecture).$(TargetConfiguration)</InstallDir>
   <LogDir>$(RootBinDir)\TestResults\$(TargetConfiguration)\sos.unittests_$(Timestamp)</LogDir>
   <DumpDir>$(RootBinDir)\tmp\$(TargetConfiguration)\dumps</DumpDir>
-  <CDBPath>$(RootBinDir)\bin\SOS.UnitTests\$(TargetConfiguration)\netcoreapp2.1\publish\runtimes\win-$(TargetArchitecture)\native\cdb.exe</CDBPath>
+  <CDBPath>$(RootBinDir)\bin\SOS.UnitTests\$(TargetConfiguration)\netcoreapp3.1\publish\runtimes\win-$(TargetArchitecture)\native\cdb.exe</CDBPath>
   <CDBHelperExtension>$(InstallDir)\runcommand.dll</CDBHelperExtension>
 
   <TestLatestOnly>false</TestLatestOnly>
@@ -38,7 +38,8 @@
   <TestDesktop Condition="'$(TargetArchitecture)' == 'arm64'">false</TestDesktop>
 
   <!-- Build the debuggee for this framework version but run it on latest -->
-  <BuildProjectFrameworkLatest Condition="StartsWith('$(RuntimeVersionLatest)', '5')">netcoreapp3.1</BuildProjectFrameworkLatest>
+  <BuildProjectFrameworkLatest Condition="StartsWith('$(RuntimeVersionLatest)', '6')">net5.0</BuildProjectFrameworkLatest>
+  <BuildProjectFrameworkLatest Condition="StartsWith('$(RuntimeVersionLatest)', '5')">net5.0</BuildProjectFrameworkLatest>
   <BuildProjectFrameworkLatest Condition="StartsWith('$(RuntimeVersionLatest)', '3.1')">netcoreapp3.1</BuildProjectFrameworkLatest>
   <BuildProjectFrameworkLatest Condition="StartsWith('$(RuntimeVersionLatest)', '2.1')">netcoreapp2.1</BuildProjectFrameworkLatest>
 
@@ -49,8 +50,7 @@
   <DebuggeeSourceRoot>$(RepoRootDir)\src\SOS\SOS.UnitTests\Debuggees</DebuggeeSourceRoot>
   <DebuggeeBuildProcess>sdk.prebuilt</DebuggeeBuildProcess>
   <DebuggeeBuildRoot>$(RootBinDir)</DebuggeeBuildRoot>
-  <!-- Always build with x64 bit dotnet -->
-  <CliPath>$(RepoRootDir)\.dotnet\dotnet.exe</CliPath>
+  <CliPath>$(DotNetRoot)\dotnet.exe</CliPath>
 
   <NuGetPackageFeeds>
       myget.org dotnet-core=https://dotnet.myget.org/F/dotnet-core/api/v3/index.json;
index 1be52fc97c21b957aa4d42cf07baa166538ed794..e866539fdf2500612e7e6127903ddf6057fc87b1 100644 (file)
@@ -33,3 +33,4 @@ add_library_clr(DesktopClrHost SHARED ${DESKTOPCLRHOST_SOURCES})
 target_link_libraries(DesktopClrHost ${DESKTOPCLRHOST_LIBRARY})
 
 install(TARGETS DesktopClrHost DESTINATION ${CLR_MANAGED_BINARY_DIR}/WebApp3/${CLR_BUILD_TYPE}/netcoreapp3.1)
+install(TARGETS DesktopClrHost DESTINATION ${CLR_MANAGED_BINARY_DIR}/WebApp3/${CLR_BUILD_TYPE}/net5.0)
index 25ce9e1dd26213c114089d06a5cec9cd35670b7b..bc18557716fc2fb67341383e2bd0dca6f879fa89 100644 (file)
@@ -2,6 +2,6 @@
   <PropertyGroup>
     <OutputType>Exe</OutputType>
     <TargetFramework Condition="'$(BuildProjectFramework)' != ''">$(BuildProjectFramework)</TargetFramework>
-    <TargetFrameworks Condition="'$(BuildProjectFramework)' == ''">netcoreapp2.1;netcoreapp3.1</TargetFrameworks>
+    <TargetFrameworks Condition="'$(BuildProjectFramework)' == ''">netcoreapp2.1;netcoreapp3.1;net5.0</TargetFrameworks>
   </PropertyGroup>
 </Project>
index 25ce9e1dd26213c114089d06a5cec9cd35670b7b..bc18557716fc2fb67341383e2bd0dca6f879fa89 100644 (file)
@@ -2,6 +2,6 @@
   <PropertyGroup>
     <OutputType>Exe</OutputType>
     <TargetFramework Condition="'$(BuildProjectFramework)' != ''">$(BuildProjectFramework)</TargetFramework>
-    <TargetFrameworks Condition="'$(BuildProjectFramework)' == ''">netcoreapp2.1;netcoreapp3.1</TargetFrameworks>
+    <TargetFrameworks Condition="'$(BuildProjectFramework)' == ''">netcoreapp2.1;netcoreapp3.1;net5.0</TargetFrameworks>
   </PropertyGroup>
 </Project>
index 25ce9e1dd26213c114089d06a5cec9cd35670b7b..bc18557716fc2fb67341383e2bd0dca6f879fa89 100644 (file)
@@ -2,6 +2,6 @@
   <PropertyGroup>
     <OutputType>Exe</OutputType>
     <TargetFramework Condition="'$(BuildProjectFramework)' != ''">$(BuildProjectFramework)</TargetFramework>
-    <TargetFrameworks Condition="'$(BuildProjectFramework)' == ''">netcoreapp2.1;netcoreapp3.1</TargetFrameworks>
+    <TargetFrameworks Condition="'$(BuildProjectFramework)' == ''">netcoreapp2.1;netcoreapp3.1;net5.0</TargetFrameworks>
   </PropertyGroup>
 </Project>
index 58f87ba98e9036e64f5df71dd697f64aeca179b3..1cefe2ae3838eb1d74eb065caafe415b6cec07ba 100644 (file)
@@ -3,6 +3,6 @@
     <OutputType>Exe</OutputType>
     <Optimize>true</Optimize>
     <TargetFramework Condition="'$(BuildProjectFramework)' != ''">$(BuildProjectFramework)</TargetFramework>
-    <TargetFrameworks Condition="'$(BuildProjectFramework)' == ''">netcoreapp2.1;netcoreapp3.1</TargetFrameworks>
+    <TargetFrameworks Condition="'$(BuildProjectFramework)' == ''">netcoreapp2.1;netcoreapp3.1;net5.0</TargetFrameworks>
   </PropertyGroup>
 </Project>
index 25ce9e1dd26213c114089d06a5cec9cd35670b7b..bc18557716fc2fb67341383e2bd0dca6f879fa89 100644 (file)
@@ -2,6 +2,6 @@
   <PropertyGroup>
     <OutputType>Exe</OutputType>
     <TargetFramework Condition="'$(BuildProjectFramework)' != ''">$(BuildProjectFramework)</TargetFramework>
-    <TargetFrameworks Condition="'$(BuildProjectFramework)' == ''">netcoreapp2.1;netcoreapp3.1</TargetFrameworks>
+    <TargetFrameworks Condition="'$(BuildProjectFramework)' == ''">netcoreapp2.1;netcoreapp3.1;net5.0</TargetFrameworks>
   </PropertyGroup>
 </Project>
index 25ce9e1dd26213c114089d06a5cec9cd35670b7b..bc18557716fc2fb67341383e2bd0dca6f879fa89 100644 (file)
@@ -2,6 +2,6 @@
   <PropertyGroup>
     <OutputType>Exe</OutputType>
     <TargetFramework Condition="'$(BuildProjectFramework)' != ''">$(BuildProjectFramework)</TargetFramework>
-    <TargetFrameworks Condition="'$(BuildProjectFramework)' == ''">netcoreapp2.1;netcoreapp3.1</TargetFrameworks>
+    <TargetFrameworks Condition="'$(BuildProjectFramework)' == ''">netcoreapp2.1;netcoreapp3.1;net5.0</TargetFrameworks>
   </PropertyGroup>
 </Project>
index 25ce9e1dd26213c114089d06a5cec9cd35670b7b..bc18557716fc2fb67341383e2bd0dca6f879fa89 100644 (file)
@@ -2,6 +2,6 @@
   <PropertyGroup>
     <OutputType>Exe</OutputType>
     <TargetFramework Condition="'$(BuildProjectFramework)' != ''">$(BuildProjectFramework)</TargetFramework>
-    <TargetFrameworks Condition="'$(BuildProjectFramework)' == ''">netcoreapp2.1;netcoreapp3.1</TargetFrameworks>
+    <TargetFrameworks Condition="'$(BuildProjectFramework)' == ''">netcoreapp2.1;netcoreapp3.1;net5.0</TargetFrameworks>
   </PropertyGroup>
 </Project>
index 25ce9e1dd26213c114089d06a5cec9cd35670b7b..bc18557716fc2fb67341383e2bd0dca6f879fa89 100644 (file)
@@ -2,6 +2,6 @@
   <PropertyGroup>
     <OutputType>Exe</OutputType>
     <TargetFramework Condition="'$(BuildProjectFramework)' != ''">$(BuildProjectFramework)</TargetFramework>
-    <TargetFrameworks Condition="'$(BuildProjectFramework)' == ''">netcoreapp2.1;netcoreapp3.1</TargetFrameworks>
+    <TargetFrameworks Condition="'$(BuildProjectFramework)' == ''">netcoreapp2.1;netcoreapp3.1;net5.0</TargetFrameworks>
   </PropertyGroup>
 </Project>
index 5938b896ff62f0f7bf3bd263ea66143aa8bd3354..e3bda46d75cccd8a8b39686384da77dbe794bf25 100644 (file)
@@ -2,7 +2,7 @@
   <PropertyGroup>
     <OutputType>Exe</OutputType>
     <TargetFramework Condition="'$(BuildProjectFramework)' != ''">$(BuildProjectFramework)</TargetFramework>
-    <TargetFrameworks Condition="'$(BuildProjectFramework)' == ''">netcoreapp2.1;netcoreapp3.1</TargetFrameworks>
+    <TargetFrameworks Condition="'$(BuildProjectFramework)' == ''">netcoreapp2.1;netcoreapp3.1;net5.0</TargetFrameworks>
     <DefineConstants Condition="'$(TargetFramework)' == 'net462'">$(DefineConstants);FULL_CLR</DefineConstants>
   </PropertyGroup>
 
index be593fc0045990ecbd9c4e79476b83a7af19208c..d9dae21d5631663b310644873a9b860ede274b43 100644 (file)
@@ -2,7 +2,7 @@
   <PropertyGroup>
     <OutputType>Library</OutputType>
     <TargetFramework Condition="'$(BuildProjectFramework)' != ''">$(BuildProjectFramework)</TargetFramework>
-    <TargetFrameworks Condition="'$(BuildProjectFramework)' == '' and '$(OS)' != 'Windows_NT'">netcoreapp2.1;netcoreapp3.1</TargetFrameworks>
-    <TargetFrameworks Condition="'$(BuildProjectFramework)' == '' and '$(OS)' == 'Windows_NT'">net462;netcoreapp2.1;netcoreapp3.1</TargetFrameworks>
+    <TargetFrameworks Condition="'$(BuildProjectFramework)' == '' and '$(OS)' != 'Windows_NT'">netcoreapp2.1;netcoreapp3.1;net5.0</TargetFrameworks>
+    <TargetFrameworks Condition="'$(BuildProjectFramework)' == '' and '$(OS)' == 'Windows_NT'">net462;netcoreapp2.1;netcoreapp3.1;net5.0</TargetFrameworks>
   </PropertyGroup>
 </Project>
index c2082b51ebadf48051f2fbfd42bac85269020439..139b6f83f5fe75443587c93a249bc097e7b2e3b3 100644 (file)
@@ -2,6 +2,6 @@
   <PropertyGroup>
     <OutputType>Library</OutputType>
     <TargetFramework Condition="'$(BuildProjectFramework)' != ''">$(BuildProjectFramework)</TargetFramework>
-    <TargetFrameworks Condition="'$(BuildProjectFramework)' == ''">netcoreapp2.1;netcoreapp3.1</TargetFrameworks>
+    <TargetFrameworks Condition="'$(BuildProjectFramework)' == ''">netcoreapp2.1;netcoreapp3.1;net5.0</TargetFrameworks>
   </PropertyGroup>
 </Project>
index cea525eec66c0af9fb390430cef6cc73d23b53a7..381e9a2eb63f0c9c99f4ce008c390c8d8314365d 100644 (file)
@@ -2,7 +2,7 @@
   <PropertyGroup>
     <OutputType>Exe</OutputType>
     <TargetFramework Condition="'$(BuildProjectFramework)' != ''">$(BuildProjectFramework)</TargetFramework>
-    <TargetFrameworks Condition="'$(BuildProjectFramework)' == ''">netcoreapp2.1;netcoreapp3.1</TargetFrameworks>
+    <TargetFrameworks Condition="'$(BuildProjectFramework)' == ''">netcoreapp2.1;netcoreapp3.1;net5.0</TargetFrameworks>
   </PropertyGroup>
 
   <ItemGroup>
index 01ec09e6042410f150bb1a3f14f990a4ad8a87b0..07df5bcd0e2bd4690ac41712cfa5a30d11e9efc0 100644 (file)
@@ -1,8 +1,11 @@
 using Microsoft.AspNetCore.Hosting;
 using Microsoft.Extensions.Hosting;
 using System;
+using System.IO;
 using System.Net.Http;
+using System.Reflection;
 using System.Runtime.InteropServices;
+using System.Security.Cryptography.X509Certificates;
 using System.Threading;
 
 namespace WebApp3
@@ -58,8 +61,15 @@ namespace WebApp3
             }
         }
 
-        public static IHostBuilder CreateHostBuilder(string[] args) =>
-            Host.CreateDefaultBuilder(args).ConfigureWebHostDefaults(webBuilder =>
-                webBuilder.UseStartup<Startup>());
+        public static IHostBuilder CreateHostBuilder(string[] args) => 
+            Host.CreateDefaultBuilder(args).ConfigureWebHostDefaults(webBuilder => { 
+                webBuilder.ConfigureKestrel(serverOptions => { 
+                    serverOptions.ConfigureHttpsDefaults(httpsOptions => {
+                        string directory = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
+                        httpsOptions.ServerCertificate = new X509Certificate2(Path.Combine(directory, "testCert.pfx"), "testPassword"); 
+                    }); 
+                }); 
+                webBuilder.UseStartup<Startup>(); 
+            });
     }
 }
index 92605c5a127db999ca1ea49e6b72df43f6847241..6602bfa15a099876fb1fc52b3a048f8969031cff 100644 (file)
@@ -1,7 +1,13 @@
 <Project Sdk="Microsoft.NET.Sdk.Web">
 
   <PropertyGroup>
-    <TargetFramework>netcoreapp3.1</TargetFramework>
+    <TargetFrameworks>netcoreapp3.1;net5.0</TargetFrameworks>
   </PropertyGroup>
 
+  <ItemGroup>
+    <Content Include="$(MSBuildThisFileDirectory)testCert.pfx">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </Content>
+  </ItemGroup>
+
 </Project>
diff --git a/src/SOS/SOS.UnitTests/Debuggees/WebApp3/testCert.pfx b/src/SOS/SOS.UnitTests/Debuggees/WebApp3/testCert.pfx
new file mode 100644 (file)
index 0000000..94befa6
Binary files /dev/null and b/src/SOS/SOS.UnitTests/Debuggees/WebApp3/testCert.pfx differ
index aa071359cfc9001e057399be87a2c65e0d259cdd..80842426fe9dd9a1458616a444e6f9d237a8ddd6 100644 (file)
@@ -3,7 +3,7 @@
   <Import Project="$(RepositoryEngineeringDir)\InstallRuntimes.proj" />
 
   <PropertyGroup>
-    <TargetFramework>netcoreapp2.1</TargetFramework>
+    <TargetFramework>netcoreapp3.1</TargetFramework>
     <IsPackable>false</IsPackable>
     <NoWarn>;1591;1701</NoWarn>
     <DefineConstants>$(DefineConstants);CORE_CLR</DefineConstants>
index 261b41d59b5a07b0069f7eb068e2a8c666cbfc41..e70250fe9b76301cc02beada8410fe1240ad97b1 100644 (file)
@@ -52,34 +52,42 @@ public class SOS
 
         if (testDump)
         {
-            // Generate a crash dump.
-            if (information.TestConfiguration.DebuggeeDumpOutputRootDir() != null)
+            // Create and test dumps on OSX only if the runtime is 5.0 or greater
+            if (OS.Kind != OSKind.OSX || information.TestConfiguration.RuntimeFrameworkVersionMajor >= 5)
             {
-                if (information.DumpGenerator == SOSRunner.DumpGenerator.NativeDebugger && SOSRunner.IsAlpine())
+                // Generate a crash dump.
+                if (information.TestConfiguration.DebuggeeDumpOutputRootDir() != null)
                 {
-                    throw new SkipTestException("lldb tests not supported on Alpine");
+                    if (information.DumpGenerator == SOSRunner.DumpGenerator.NativeDebugger && SOSRunner.IsAlpine())
+                    {
+                        throw new SkipTestException("lldb tests not supported on Alpine");
+                    }
+                    await SOSRunner.CreateDump(information);
                 }
-                await SOSRunner.CreateDump(information);
-            }
 
-            // Test against a crash dump.
-            if (information.TestConfiguration.DebuggeeDumpInputRootDir() != null)
-            {
-                if (!SOSRunner.IsAlpine())
+                // Test against a crash dump.
+                if (information.TestConfiguration.DebuggeeDumpInputRootDir() != null)
                 {
-                    // With cdb (Windows) or lldb (Linux or OSX)
-                    using (SOSRunner runner = await SOSRunner.StartDebugger(information, SOSRunner.DebuggerAction.LoadDump))
+                    if (!SOSRunner.IsAlpine() && OS.Kind != OSKind.OSX)
                     {
-                        await runner.RunScript(scriptName);
+                        // With cdb (Windows) or lldb (Linux)
+                        using (SOSRunner runner = await SOSRunner.StartDebugger(information, SOSRunner.DebuggerAction.LoadDump))
+                        {
+                            await runner.RunScript(scriptName);
+                        }
                     }
-                }
 
-                // Using the dotnet-dump analyze tool if the path exists in the config file. Don't test dotnet-dump on triage dumps when running on desktop CLR.
-                if (information.TestConfiguration.DotNetDumpPath() != null && (information.TestConfiguration.IsNETCore || information.DumpType != SOSRunner.DumpType.Triage))
-                {
-                    using (SOSRunner runner = await SOSRunner.StartDebugger(information, SOSRunner.DebuggerAction.LoadDumpWithDotNetDump))
+                    // Using the dotnet-dump analyze tool if the path exists in the config file.
+                    if (information.TestConfiguration.DotNetDumpPath() != null)
                     {
-                        await runner.RunScript(scriptName);
+                        // Don't test dotnet-dump on triage dumps when running on desktop CLR.
+                        if (information.TestConfiguration.IsNETCore || information.DumpType != SOSRunner.DumpType.Triage)
+                        {
+                            using (SOSRunner runner = await SOSRunner.StartDebugger(information, SOSRunner.DebuggerAction.LoadDumpWithDotNetDump))
+                            {
+                                await runner.RunScript(scriptName);
+                            }
+                        }
                     }
                 }
             }
index 933549b48ec04f79d35e401a425009f70da7edc7..041859f40548abd759e867fed96906b1eb4d7087 100644 (file)
@@ -218,6 +218,7 @@ public class SOSRunner : IDisposable
                 // Get the full debuggee launch command line (includes the host if required)
                 string exePath = debuggeeConfig.BinaryExePath;
                 var arguments = new StringBuilder();
+
                 if (!string.IsNullOrWhiteSpace(config.HostExe))
                 {
                     exePath = config.HostExe;
@@ -248,15 +249,12 @@ public class SOSRunner : IDisposable
 
                 // Create the debuggee process runner
                 ProcessRunner processRunner = new ProcessRunner(exePath, ReplaceVariables(variables, arguments.ToString())).
+                    WithEnvironmentVariable("COMPlus_DbgEnableElfDumpOnMacOS", "1").
                     WithLog(new TestRunner.TestLogger(outputHelper.IndentedOutput)).
                     WithTimeout(TimeSpan.FromMinutes(5));
 
                 if (dumpGeneration == DumpGenerator.CreateDump)
                 {
-                    if (OS.Kind == OSKind.OSX)
-                    {
-                        throw new SkipTestException("Createdump doesn't exists on MacOS");
-                    }
                     // Run the debuggee with the createdump environment variables set to generate a coredump on unhandled exception
                     processRunner.
                         WithEnvironmentVariable("COMPlus_DbgEnableMiniDump", "1").
@@ -307,7 +305,7 @@ public class SOSRunner : IDisposable
                         // Start dotnet-dump collect
                         var dotnetDumpArguments = new StringBuilder();
                         dotnetDumpArguments.Append(config.DotNetDumpPath());
-                        dotnetDumpArguments.AppendFormat(" collect --process-id {0} --output %DUMP_NAME%", processRunner.ProcessId);
+                        dotnetDumpArguments.AppendFormat(" collect --diag --process-id {0} --output %DUMP_NAME%", processRunner.ProcessId);
 
                         ProcessRunner dotnetDumpRunner = new ProcessRunner(config.DotNetDumpHost(), ReplaceVariables(variables, dotnetDumpArguments.ToString())).
                             WithLog(new TestRunner.TestLogger(dotnetDumpOutputHelper)).
@@ -415,7 +413,7 @@ public class SOSRunner : IDisposable
             string debuggerPath = GetNativeDebuggerPath(debugger, config);
             if (string.IsNullOrWhiteSpace(debuggerPath) || !File.Exists(debuggerPath))
             {
-                throw new FileNotFoundException($"Native debugger path not set or does not exist: {debuggerPath}");
+                throw new FileNotFoundException($"Native debugger ({debugger}) path not set or does not exist: {debuggerPath}");
             }
 
             // Get the debugger arguments and commands to run initially
index fa91dfe36306bf4d65408542dd8e79de1e5bd072..4311ea900bb6c884150612d84ef8c56931290e16 100644 (file)
@@ -1475,11 +1475,25 @@ void PrintRuntimeTypeInfo(TADDR p_rtObject, const DacpObjectData & rtObjectData)
     }
 }
 
+void DisplayInvalidStructuresMessage()
+{
+    ExtOut("The garbage collector data structures are not in a valid state for traversal.\n");
+    ExtOut("It is either in the \"plan phase,\" where objects are being moved around, or\n");
+    ExtOut("we are at the initialization or shutdown of the gc heap. Commands related to \n");
+    ExtOut("displaying, finding or traversing objects as well as gc heap segments may not \n");
+    ExtOut("work properly. !dumpheap and !verifyheap may incorrectly complain of heap \n");
+    ExtOut("consistency errors.\n");
+}
+
 HRESULT PrintObj(TADDR taObj, BOOL bPrintFields = TRUE)
 {
     if (!sos::IsObject(taObj, true))
     {
         ExtOut("<Note: this object has an invalid CLASS field>\n");
+        if (!GetGcStructuresValid())
+        {
+            DisplayInvalidStructuresMessage();
+        }
     }
 
     DacpObjectData objData;
@@ -2641,7 +2655,11 @@ HRESULT FormatException(CLRDATA_ADDRESS taObj, BOOL bLineNumbers = FALSE)
     DacpObjectData objData;
     if ((Status=objData.Request(g_sos, taObj)) != S_OK)
     {
-        ExtOut("Invalid object\n");
+        ExtOut("Invalid exception object: %016llx\n", taObj);
+        if (!GetGcStructuresValid())
+        {
+            DisplayInvalidStructuresMessage();
+        }
         return Status;
     }
 
@@ -3458,16 +3476,6 @@ void GCPrintSegmentInfo(DacpGcHeapDetails &heap, DWORD_PTR &total_size);
 
 #endif // FEATURE_PAL
 
-void DisplayInvalidStructuresMessage()
-{
-    ExtOut("The garbage collector data structures are not in a valid state for traversal.\n");
-    ExtOut("It is either in the \"plan phase,\" where objects are being moved around, or\n");
-    ExtOut("we are at the initialization or shutdown of the gc heap. Commands related to \n");
-    ExtOut("displaying, finding or traversing objects as well as gc heap segments may not \n");
-    ExtOut("work properly. !dumpheap and !verifyheap may incorrectly complain of heap \n");
-    ExtOut("consistency errors.\n");
-}
-
 /**********************************************************************\
 * Routine Description:                                                 *
 *                                                                      *