Add single-file app SOS testing Part I (#2153)
authorMike McLaughlin <mikem@microsoft.com>
Thu, 8 Apr 2021 23:37:38 +0000 (16:37 -0700)
committerGitHub <noreply@github.com>
Thu, 8 Apr 2021 23:37:38 +0000 (16:37 -0700)
This PR gets ready for single-file app testing, but doesn't add the app yet
because the current SDK can't build them and the new SDKs break building
the cli built debuggees.

Also works around that the DAC GetPEFileName()/GetAssemblyName() APIs don't return
the module or assembly name.

24 files changed:
src/Microsoft.Diagnostics.TestHelpers/BaseDebuggeeCompiler.cs
src/Microsoft.Diagnostics.TestHelpers/CliDebuggeeCompiler.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/Directory.Build.props
src/SOS/SOS.UnitTests/Debuggees/DivZero/DivZero.csproj
src/SOS/SOS.UnitTests/Debuggees/DotnetDumpCommands/DotnetDumpCommands.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/WebApp3.csproj
src/SOS/SOS.UnitTests/SOSRunner.cs
src/SOS/Strike/strike.cpp
src/SOS/Strike/util.cpp

index 64ec40158c94e2809fba8403fc403f2ca73d6ee2..8545164c69c06f47ba1867c542c68f0d03100c83 100644 (file)
@@ -151,7 +151,7 @@ namespace Microsoft.Diagnostics.TestHelpers
 
         protected virtual string GetDebuggeeBinaryDirPath(string debuggeeProjectDirPath, string framework, string runtime)
         {
-            string debuggeeBinaryDirPath = null;
+            string debuggeeBinaryDirPath;
             if (runtime != null)
             {
                 debuggeeBinaryDirPath = Path.Combine(debuggeeProjectDirPath, "bin", "Debug", framework, runtime);
@@ -163,14 +163,14 @@ namespace Microsoft.Diagnostics.TestHelpers
             return debuggeeBinaryDirPath;
         }
 
-        protected static string GetDebuggeeBinaryDllPath(string debuggeeBinaryDirPath, string debuggeeName)
+        protected static string GetDebuggeeBinaryDllPath(TestConfiguration config, string debuggeeBinaryDirPath, string debuggeeName)
         {
-            return Path.Combine(debuggeeBinaryDirPath, debuggeeName + ".dll");
+            return config.IsNETCore ? Path.Combine(debuggeeBinaryDirPath, debuggeeName + (config.PublishSingleFile ? "" : ".dll")) : null;
         }
 
-        protected static string GetDebuggeeBinaryExePath(string debuggeeBinaryDirPath, string debuggeeName)
+        protected static string GetDebuggeeBinaryExePath(TestConfiguration config, string debuggeeBinaryDirPath, string debuggeeName)
         {
-            return Path.Combine(debuggeeBinaryDirPath, debuggeeName + ".exe");
+            return config.IsDesktop ? Path.Combine(debuggeeBinaryDirPath, debuggeeName + ".exe") : null;
         }
 
         protected static string GetLogPath(TestConfiguration config, string framework, string runtime, string debuggeeName)
index 62ca520a7d4cea7499ef4c3bf03cde3488e72c97..e51c3be9deeebbef26ffbc6714def7dc6961eb5b 100644 (file)
@@ -3,6 +3,7 @@
 // See the LICENSE file in the project root for more information.
 
 using System.Collections.Generic;
+using System.Diagnostics;
 using System.IO;
 
 namespace Microsoft.Diagnostics.TestHelpers
@@ -33,6 +34,11 @@ namespace Microsoft.Diagnostics.TestHelpers
             {
                 buildProperties.Add("RuntimeIdentifier", runtimeIdentifier);
             }
+            if (config.PublishSingleFile)
+            {
+                Debug.Assert(runtimeIdentifier != null);
+                buildProperties.Add("PublishSingleFile", "true");
+            }
             string debugType = config.DebugType;
             if (debugType == null)
             {
@@ -64,8 +70,8 @@ namespace Microsoft.Diagnostics.TestHelpers
             string debuggeeSolutionDirPath = GetDebuggeeSolutionDirPath(dotNetRootBuildDirPath, debuggeeName);
             string debuggeeProjectDirPath = GetDebuggeeProjectDirPath(debuggeeSolutionDirPath, initialSourceDirPath, debuggeeName);
             string debuggeeBinaryDirPath = GetDebuggeeBinaryDirPath(debuggeeProjectDirPath, framework, runtimeIdentifier);
-            string debuggeeBinaryDllPath = config.IsNETCore ? GetDebuggeeBinaryDllPath(debuggeeBinaryDirPath, debuggeeName) : null;
-            string debuggeeBinaryExePath = config.IsDesktop ? GetDebuggeeBinaryExePath(debuggeeBinaryDirPath, debuggeeName) : null;
+            string debuggeeBinaryDllPath = GetDebuggeeBinaryDllPath(config, debuggeeBinaryDirPath, debuggeeName);
+            string debuggeeBinaryExePath = GetDebuggeeBinaryExePath(config, debuggeeBinaryDirPath, debuggeeName);
             string logPath = GetLogPath(config, framework, runtimeIdentifier, debuggeeName);
             return new CsprojBuildDebuggeeTestStep(dotNetPath,
                                                initialSourceDirPath,
index f78930fe0a49a74d01e58c332a100b4c2cc70478..c5bb7ee9a3a4be8a5937ac2069b0da0825b0f49b 100644 (file)
@@ -629,6 +629,14 @@ namespace Microsoft.Diagnostics.TestHelpers
             get { return GetValue("BuildProjectRuntime"); }
         }
 
+        /// <summary>
+        /// Returns "true" if build/run this cli debuggee as a single-file app
+        /// </summary>
+        public bool PublishSingleFile
+        {
+            get { return string.Equals(GetValue("PublishSingleFile"), "true", StringComparison.InvariantCultureIgnoreCase); }
+        }
+
         /// <summary>
         /// The version of the Microsoft.NETCore.App package to reference when running the debuggee (i.e. 
         /// using the dotnet cli --fx-version option).
@@ -711,7 +719,7 @@ namespace Microsoft.Diagnostics.TestHelpers
         /// </summary>
         public bool LogToConsole
         {
-            get { return bool.TryParse(GetValue("LogToConsole"), out bool b) && b; }
+            get { return string.Equals(GetValue("LogToConsole"), "true", StringComparison.InvariantCultureIgnoreCase); }
         }
 
         /// <summary>
index c1bd8d9823eebc4e7f1bba64864b017841bb3112..60c10ec77229092bb2210254082c487ed293318d 100644 (file)
@@ -34,7 +34,7 @@
   <TestDotnetDumpCommandsWithRuntime21 Condition="'$(OS)' == 'Linux'">false</TestDotnetDumpCommandsWithRuntime21>
 
   <!-- Build the debuggee for this framework version but run it on latest -->
-  <BuildProjectFrameworkLatest Condition="StartsWith('$(RuntimeVersionLatest)', '6')">net5.0</BuildProjectFrameworkLatest>
+  <BuildProjectFrameworkLatest Condition="StartsWith('$(RuntimeVersionLatest)', '6')">net6.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>
@@ -45,8 +45,9 @@
   <CliPath>$(DotNetRoot)/dotnet</CliPath>
 
   <NuGetPackageFeeds>
-      myget.org dotnet-core=https://dotnet.myget.org/F/dotnet-core/api/v3/index.json;
-      nuget.org=https://www.nuget.org/api/v2/
+      dotnet6=https://dnceng.pkgs.visualstudio.com/public/_packaging/dotnet6/nuget/v3/index.json;
+      dotnet-core=https://dotnetfeed.blob.core.windows.net/dotnet-core/index.json;
+      dotnet-public=https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public/nuget/v3/index.json
   </NuGetPackageFeeds>
 
   <Options>
@@ -73,7 +74,7 @@
       <SetHostRuntime>$(DotNetRoot)/shared/Microsoft.NETCore.App/$(RuntimeFrameworkVersion)</SetHostRuntime>
     </Option>
     <!--
-        SOS.StackAndOtherTests (cli because tested with embedded and portable PDBs)
+        SOS.StackAndOtherTests (cli because tested with embedded, portable PDBs and single-file)
       -->
     <Option>
       <DebuggeeBuildProcess>cli</DebuggeeBuildProcess>
       <TestName>SOS.StackAndOtherTests</TestName>
       <Options>
         <Option Condition="'$(RuntimeVersionLatest)' != ''">
-          <BuildProjectFramework>$(BuildProjectFrameworkLatest)</BuildProjectFramework>
-          <RuntimeFrameworkVersion>$(RuntimeVersionLatest)</RuntimeFrameworkVersion>
+          <Options>
+            <Option>
+              <BuildProjectFramework>$(BuildProjectFrameworkLatest)</BuildProjectFramework>
+              <RuntimeFrameworkVersion>$(RuntimeVersionLatest)</RuntimeFrameworkVersion>
+            </Option>
+          </Options>
         </Option>
         <Option Condition="'$(RuntimeVersion50)' != ''">
           <BuildProjectFramework>net5.0</BuildProjectFramework>
   <FrameworkVersion Condition="'$(FrameworkVersion)' == ''">$(RuntimeFrameworkVersion)</FrameworkVersion>
   <RuntimeSymbolsPath>$(DotNetRoot)/shared/Microsoft.NETCore.App/$(RuntimeFrameworkVersion)</RuntimeSymbolsPath>
   <LLDBHelperScript>$(ScriptRootDir)/lldbhelper.py</LLDBHelperScript>
-  <HostExe>$(DotNetRoot)/dotnet</HostExe>
-  <HostArgs>--fx-version $(FrameworkVersion)</HostArgs>
+
+  <!-- Single-file debuggees don't need the host -->
+  <HostExe Condition="'$(PublishSingleFile)' != 'true'">$(DotNetRoot)/dotnet</HostExe>
+  <HostArgs Condition="'$(PublishSingleFile)' != 'true'">--fx-version $(FrameworkVersion)</HostArgs>
 
   <Options>
     <Option Condition="$(OS) == Linux">
index d866cd0f7df9556bf2323959b86bbfa49163b298..605845e212e8d4e4ab16aa8273adad8abad98d54 100644 (file)
@@ -36,7 +36,7 @@
   <TestDesktop Condition="'$(TargetArchitecture)' == 'arm64'">false</TestDesktop>
 
   <!-- Build the debuggee for this framework version but run it on latest -->
-  <BuildProjectFrameworkLatest Condition="StartsWith('$(RuntimeVersionLatest)', '6')">net5.0</BuildProjectFrameworkLatest>
+  <BuildProjectFrameworkLatest Condition="StartsWith('$(RuntimeVersionLatest)', '6')">net6.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>
@@ -51,8 +51,9 @@
   <CliPath>$(DotNetRoot)\dotnet.exe</CliPath>
 
   <NuGetPackageFeeds>
-      myget.org dotnet-core=https://dotnet.myget.org/F/dotnet-core/api/v3/index.json;
-      nuget.org=https://www.nuget.org/api/v2/
+      dotnet6=https://dnceng.pkgs.visualstudio.com/public/_packaging/dotnet6/nuget/v3/index.json;
+      dotnet-core=https://dotnetfeed.blob.core.windows.net/dotnet-core/index.json;
+      dotnet-public=https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public/nuget/v3/index.json
   </NuGetPackageFeeds>
 
   <Options>
index e866539fdf2500612e7e6127903ddf6057fc87b1..9584de7acbdbd2821804d005f6d3000baba587a0 100644 (file)
@@ -34,3 +34,4 @@ 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)
+install(TARGETS DesktopClrHost DESTINATION ${CLR_MANAGED_BINARY_DIR}/WebApp3/${CLR_BUILD_TYPE}/net6.0)
index 85e4a36a1b7e57c181328987c22edae175212ef0..0c37abe08c2bf439a9c7dcaab78961c03211e8b2 100644 (file)
@@ -6,5 +6,6 @@
     <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
     <IsShippingAssembly>false</IsShippingAssembly>
     <Optimize>false</Optimize>
+    <BuildTargetFrameworks>netcoreapp2.1;netcoreapp3.1;net5.0;net6.0</BuildTargetFrameworks>
   </PropertyGroup>
 </Project>
index bc18557716fc2fb67341383e2bd0dca6f879fa89..03cd2f5e0e95ba77fa84d5769e2fe3b5113d0fbe 100644 (file)
@@ -2,6 +2,6 @@
   <PropertyGroup>
     <OutputType>Exe</OutputType>
     <TargetFramework Condition="'$(BuildProjectFramework)' != ''">$(BuildProjectFramework)</TargetFramework>
-    <TargetFrameworks Condition="'$(BuildProjectFramework)' == ''">netcoreapp2.1;netcoreapp3.1;net5.0</TargetFrameworks>
+    <TargetFrameworks Condition="'$(BuildProjectFramework)' == ''">$(BuildTargetFrameworks)</TargetFrameworks>
   </PropertyGroup>
 </Project>
index 55f2127be7efa8ac8a1d49094b4a254f3a361e1f..03cd2f5e0e95ba77fa84d5769e2fe3b5113d0fbe 100644 (file)
@@ -1,7 +1,7 @@
 <Project Sdk="Microsoft.NET.Sdk">
   <PropertyGroup>
-       <OutputType>Exe</OutputType>
-       <TargetFramework Condition="'$(BuildProjectFramework)' != ''">$(BuildProjectFramework)</TargetFramework>
-       <TargetFrameworks Condition="'$(BuildProjectFramework)' == ''">netcoreapp2.1;netcoreapp3.1;net5.0</TargetFrameworks>
+    <OutputType>Exe</OutputType>
+    <TargetFramework Condition="'$(BuildProjectFramework)' != ''">$(BuildProjectFramework)</TargetFramework>
+    <TargetFrameworks Condition="'$(BuildProjectFramework)' == ''">$(BuildTargetFrameworks)</TargetFrameworks>
   </PropertyGroup>
-</Project>
\ No newline at end of file
+</Project>
index bc18557716fc2fb67341383e2bd0dca6f879fa89..03cd2f5e0e95ba77fa84d5769e2fe3b5113d0fbe 100644 (file)
@@ -2,6 +2,6 @@
   <PropertyGroup>
     <OutputType>Exe</OutputType>
     <TargetFramework Condition="'$(BuildProjectFramework)' != ''">$(BuildProjectFramework)</TargetFramework>
-    <TargetFrameworks Condition="'$(BuildProjectFramework)' == ''">netcoreapp2.1;netcoreapp3.1;net5.0</TargetFrameworks>
+    <TargetFrameworks Condition="'$(BuildProjectFramework)' == ''">$(BuildTargetFrameworks)</TargetFrameworks>
   </PropertyGroup>
 </Project>
index bc18557716fc2fb67341383e2bd0dca6f879fa89..03cd2f5e0e95ba77fa84d5769e2fe3b5113d0fbe 100644 (file)
@@ -2,6 +2,6 @@
   <PropertyGroup>
     <OutputType>Exe</OutputType>
     <TargetFramework Condition="'$(BuildProjectFramework)' != ''">$(BuildProjectFramework)</TargetFramework>
-    <TargetFrameworks Condition="'$(BuildProjectFramework)' == ''">netcoreapp2.1;netcoreapp3.1;net5.0</TargetFrameworks>
+    <TargetFrameworks Condition="'$(BuildProjectFramework)' == ''">$(BuildTargetFrameworks)</TargetFrameworks>
   </PropertyGroup>
 </Project>
index 1cefe2ae3838eb1d74eb065caafe415b6cec07ba..c704adf493711462c593fc2468052d46476079ce 100644 (file)
@@ -3,6 +3,6 @@
     <OutputType>Exe</OutputType>
     <Optimize>true</Optimize>
     <TargetFramework Condition="'$(BuildProjectFramework)' != ''">$(BuildProjectFramework)</TargetFramework>
-    <TargetFrameworks Condition="'$(BuildProjectFramework)' == ''">netcoreapp2.1;netcoreapp3.1;net5.0</TargetFrameworks>
+    <TargetFrameworks Condition="'$(BuildProjectFramework)' == ''">$(BuildTargetFrameworks)</TargetFrameworks>
   </PropertyGroup>
 </Project>
index bc18557716fc2fb67341383e2bd0dca6f879fa89..03cd2f5e0e95ba77fa84d5769e2fe3b5113d0fbe 100644 (file)
@@ -2,6 +2,6 @@
   <PropertyGroup>
     <OutputType>Exe</OutputType>
     <TargetFramework Condition="'$(BuildProjectFramework)' != ''">$(BuildProjectFramework)</TargetFramework>
-    <TargetFrameworks Condition="'$(BuildProjectFramework)' == ''">netcoreapp2.1;netcoreapp3.1;net5.0</TargetFrameworks>
+    <TargetFrameworks Condition="'$(BuildProjectFramework)' == ''">$(BuildTargetFrameworks)</TargetFrameworks>
   </PropertyGroup>
 </Project>
index bc18557716fc2fb67341383e2bd0dca6f879fa89..03cd2f5e0e95ba77fa84d5769e2fe3b5113d0fbe 100644 (file)
@@ -2,6 +2,6 @@
   <PropertyGroup>
     <OutputType>Exe</OutputType>
     <TargetFramework Condition="'$(BuildProjectFramework)' != ''">$(BuildProjectFramework)</TargetFramework>
-    <TargetFrameworks Condition="'$(BuildProjectFramework)' == ''">netcoreapp2.1;netcoreapp3.1;net5.0</TargetFrameworks>
+    <TargetFrameworks Condition="'$(BuildProjectFramework)' == ''">$(BuildTargetFrameworks)</TargetFrameworks>
   </PropertyGroup>
 </Project>
index bc18557716fc2fb67341383e2bd0dca6f879fa89..03cd2f5e0e95ba77fa84d5769e2fe3b5113d0fbe 100644 (file)
@@ -2,6 +2,6 @@
   <PropertyGroup>
     <OutputType>Exe</OutputType>
     <TargetFramework Condition="'$(BuildProjectFramework)' != ''">$(BuildProjectFramework)</TargetFramework>
-    <TargetFrameworks Condition="'$(BuildProjectFramework)' == ''">netcoreapp2.1;netcoreapp3.1;net5.0</TargetFrameworks>
+    <TargetFrameworks Condition="'$(BuildProjectFramework)' == ''">$(BuildTargetFrameworks)</TargetFrameworks>
   </PropertyGroup>
 </Project>
index bc18557716fc2fb67341383e2bd0dca6f879fa89..03cd2f5e0e95ba77fa84d5769e2fe3b5113d0fbe 100644 (file)
@@ -2,6 +2,6 @@
   <PropertyGroup>
     <OutputType>Exe</OutputType>
     <TargetFramework Condition="'$(BuildProjectFramework)' != ''">$(BuildProjectFramework)</TargetFramework>
-    <TargetFrameworks Condition="'$(BuildProjectFramework)' == ''">netcoreapp2.1;netcoreapp3.1;net5.0</TargetFrameworks>
+    <TargetFrameworks Condition="'$(BuildProjectFramework)' == ''">$(BuildTargetFrameworks)</TargetFrameworks>
   </PropertyGroup>
 </Project>
index e3bda46d75cccd8a8b39686384da77dbe794bf25..662b5503441a0e37a8bae2242d96225d0e2aa4ce 100644 (file)
@@ -2,7 +2,7 @@
   <PropertyGroup>
     <OutputType>Exe</OutputType>
     <TargetFramework Condition="'$(BuildProjectFramework)' != ''">$(BuildProjectFramework)</TargetFramework>
-    <TargetFrameworks Condition="'$(BuildProjectFramework)' == ''">netcoreapp2.1;netcoreapp3.1;net5.0</TargetFrameworks>
+    <TargetFrameworks Condition="'$(BuildProjectFramework)' == ''">$(BuildTargetFrameworks)</TargetFrameworks>
     <DefineConstants Condition="'$(TargetFramework)' == 'net462'">$(DefineConstants);FULL_CLR</DefineConstants>
   </PropertyGroup>
 
index d9dae21d5631663b310644873a9b860ede274b43..01794bdad72569d8d8056abaf982c9f4df1b423c 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;net5.0</TargetFrameworks>
-    <TargetFrameworks Condition="'$(BuildProjectFramework)' == '' and '$(OS)' == 'Windows_NT'">net462;netcoreapp2.1;netcoreapp3.1;net5.0</TargetFrameworks>
+    <TargetFrameworks Condition="'$(BuildProjectFramework)' == '' and '$(OS)' != 'Windows_NT'">$(BuildTargetFrameworks)</TargetFrameworks>
+    <TargetFrameworks Condition="'$(BuildProjectFramework)' == '' and '$(OS)' == 'Windows_NT'">net462;$(BuildTargetFrameworks)</TargetFrameworks>
   </PropertyGroup>
 </Project>
index 139b6f83f5fe75443587c93a249bc097e7b2e3b3..e6fd811af7b64d1af197cf481452783912acf513 100644 (file)
@@ -2,6 +2,6 @@
   <PropertyGroup>
     <OutputType>Library</OutputType>
     <TargetFramework Condition="'$(BuildProjectFramework)' != ''">$(BuildProjectFramework)</TargetFramework>
-    <TargetFrameworks Condition="'$(BuildProjectFramework)' == ''">netcoreapp2.1;netcoreapp3.1;net5.0</TargetFrameworks>
+    <TargetFrameworks Condition="'$(BuildProjectFramework)' == ''">$(BuildTargetFrameworks)</TargetFrameworks>
   </PropertyGroup>
 </Project>
index 381e9a2eb63f0c9c99f4ce008c390c8d8314365d..1285b3532fc8c73bfa12be1ca710110be318cb7b 100644 (file)
@@ -2,7 +2,7 @@
   <PropertyGroup>
     <OutputType>Exe</OutputType>
     <TargetFramework Condition="'$(BuildProjectFramework)' != ''">$(BuildProjectFramework)</TargetFramework>
-    <TargetFrameworks Condition="'$(BuildProjectFramework)' == ''">netcoreapp2.1;netcoreapp3.1;net5.0</TargetFrameworks>
+    <TargetFrameworks Condition="'$(BuildProjectFramework)' == ''">$(BuildTargetFrameworks)</TargetFrameworks>
   </PropertyGroup>
 
   <ItemGroup>
index 6602bfa15a099876fb1fc52b3a048f8969031cff..efd2369d3a68cf157a0c7d01dfcc928787ffcb4f 100644 (file)
@@ -1,7 +1,7 @@
 <Project Sdk="Microsoft.NET.Sdk.Web">
 
   <PropertyGroup>
-    <TargetFrameworks>netcoreapp3.1;net5.0</TargetFrameworks>
+    <TargetFrameworks>netcoreapp3.1;net5.0;net6.0</TargetFrameworks>
   </PropertyGroup>
 
   <ItemGroup>
index 026c0cfbac176efae865c90033699dd6ed43015c..7f29f0bebf57ca88b7241d37956535495edf66a4 100644 (file)
@@ -483,10 +483,16 @@ public class SOSRunner : IDisposable
                     }
                     arguments.AppendFormat(@"--no-lldbinit -o ""settings set interpreter.prompt-on-quit false"" -o ""command script import {0}"" -o ""version""", lldbHelperScript);
 
+                    string debuggeeTarget = config.HostExe;
+                    if (string.IsNullOrWhiteSpace(debuggeeTarget))
+                    {
+                        debuggeeTarget = debuggeeConfig.BinaryExePath;
+                    }
+
                     // Load the dump or launch the debuggee process
                     if (action == DebuggerAction.LoadDump)
                     {
-                        initialCommands.Add($@"target create --core ""%DUMP_NAME%"" ""{config.HostExe}""");
+                        initialCommands.Add($@"target create --core ""%DUMP_NAME%"" ""{debuggeeTarget}""");
                     }
                     else
                     {
@@ -499,7 +505,10 @@ public class SOSRunner : IDisposable
                                 sb.AppendFormat(@" ""{0}""", arg);
                             }
                         }
-                        sb.AppendFormat(@" ""{0}""", debuggeeConfig.BinaryExePath);
+                        if (!string.IsNullOrWhiteSpace(config.HostExe))
+                        {
+                            sb.AppendFormat(@" ""{0}""", debuggeeConfig.BinaryExePath);
+                        }
                         if (!string.IsNullOrWhiteSpace(information.DebuggeeArguments))
                         {
                             string[] args = ReplaceVariables(variables, information.DebuggeeArguments).Trim().Split(' ');
@@ -508,7 +517,7 @@ public class SOSRunner : IDisposable
                                 sb.AppendFormat(@" ""{0}""", arg);
                             }
                         }
-                        initialCommands.Add($@"target create ""{config.HostExe}""");
+                        initialCommands.Add($@"target create ""{debuggeeTarget}""");
                         initialCommands.Add(sb.ToString());
                         initialCommands.Add("process launch -s");
 
@@ -1216,6 +1225,10 @@ public class SOSRunner : IDisposable
         {
             defines.Add("NETCORE_OR_DOTNETDUMP");
         }
+        if (_config.PublishSingleFile)
+        {
+            defines.Add("SINGLE_FILE_APP");
+        }
         return defines;
     }
 
index ca7af6ba27da342bc8b9d67053388eb956d71dba..a564c93c9ccf51b04014be394cb7c3bb83645b02 100644 (file)
@@ -15170,18 +15170,25 @@ static HRESULT DumpMDInfoBuffer(DWORD_PTR dwStartAddr, DWORD Flags, ULONG64 Esp,
     // If the dbgeng functions fail to get the module/assembly name, use the DAC API
     if (!bModuleNameWorked)
     {
-        if (g_sos->GetPEFileName(dmd.File, MAX_LONGPATH, wszNameBuffer, NULL) == S_OK)
+        wszNameBuffer[0] = W('\0');
+        if (FAILED(g_sos->GetPEFileName(dmd.File, MAX_LONGPATH, wszNameBuffer, NULL)) || wszNameBuffer[0] == W('\0'))
         {
-            if (wszNameBuffer[0] != W('\0'))
+            ToRelease<IXCLRDataModule> pModule;
+            if (SUCCEEDED(g_sos->GetModule(dmd.Address, &pModule)))
             {
-                WCHAR *pJustName = _wcsrchr(wszNameBuffer, GetTargetDirectorySeparatorW());
-                if (pJustName == NULL)
-                    pJustName = wszNameBuffer - 1;
-
-                DOAPPEND(pJustName + 1);
-                bModuleNameWorked = TRUE;
+                ULONG32 nameLen = 0;
+                pModule->GetFileName(MAX_LONGPATH, &nameLen, wszNameBuffer);
             }
         }
+        if (wszNameBuffer[0] != W('\0'))
+        {
+            WCHAR *pJustName = _wcsrchr(wszNameBuffer, GetTargetDirectorySeparatorW());
+            if (pJustName == NULL)
+                pJustName = wszNameBuffer - 1;
+
+            DOAPPEND(pJustName + 1);
+            bModuleNameWorked = TRUE;
+        }
     }
 
     // Under certain circumstances DacpMethodDescData::GetMethodDescName()
index 7cb722b0e882f2bcdab0aa40b4bf9e82c307c120..e96899872f4410ecc8f7a4a96990b658329fe5d9 100644 (file)
@@ -1575,38 +1575,44 @@ HRESULT FileNameForModule (DWORD_PTR pModuleAddr, __out_ecount (MAX_LONGPATH) WC
 *                                                                      *
 \**********************************************************************/
 // fileName should be at least MAX_LONGPATH
-HRESULT FileNameForModule (const DacpModuleData * const pModule, __out_ecount (MAX_LONGPATH) WCHAR *fileName)
+HRESULT FileNameForModule(const DacpModuleData* const pModuleData, __out_ecount(MAX_LONGPATH) WCHAR* fileName)
 {
-    fileName[0] = L'\0';
-    
+    fileName[0] = W('\0');
+
     HRESULT hr = S_OK;
-    CLRDATA_ADDRESS dwAddr = pModule->File;
+    CLRDATA_ADDRESS dwAddr = pModuleData->File;
     if (dwAddr == 0)
     {
         // TODO:  We have dynamic module
         return E_NOTIMPL;
     }
-    
+
     CLRDATA_ADDRESS base = 0;
     hr = g_sos->GetPEFileBase(dwAddr, &base);
     if (SUCCEEDED(hr))
     {
         hr = g_sos->GetPEFileName(dwAddr, MAX_LONGPATH, fileName, NULL);
-        if (SUCCEEDED(hr))
-        {
-            if (fileName[0] != W('\0'))
-                return hr; // done
-        }
+        if (SUCCEEDED(hr) && fileName[0] != W('\0'))
+            return hr; // done
+
 #ifndef FEATURE_PAL
         // Try the base *
         if (base)
         {
-            hr = DllsName((ULONG_PTR) base, fileName);
+            hr = DllsName((ULONG_PTR)base, fileName);
+            if (SUCCEEDED(hr) && fileName[0] != W('\0'))
+                return hr; // done
         }
 #endif // !FEATURE_PAL
     }
+
+    ToRelease<IXCLRDataModule> pModule;
+    if (SUCCEEDED(g_sos->GetModule(pModuleData->Address, &pModule)))
+    {
+        ULONG32 nameLen = 0;
+        hr = pModule->GetFileName(MAX_LONGPATH, &nameLen, fileName);
+    }
     
-    // If we got here, either DllsName worked, or we couldn't find a name
     return hr;
 }