Skip to content

Commit 5734230

Browse files
author
Mike McLaughlin
authored
Fixes for some vendors issues for the stable release (#1785) (#1787)
* Fixes for some vendors issues for the stable release (#1785) * Fixes for some vendors issues for the stable release 1) Stop printing the "@(#)Version" prefix of the SOS version on Linux. 2) Change the default symbol cache for dotnet-dump on Windows to VS's. 3) Fix eeversion unhandled exception on Linux when hosted on 5.0.0. 4) Fix `dotnet-dump collect --help` ArgumentOutOfRangeException by reformatting the --type option description. * Fix eeversion unhandled exception on Linux hosted on 5.0.0 This turned out to be that the dotnet-sos installed included runtime binaries like System.Memory, System.Buffer, etc. that were wrong version for hosting on 5.0.0. This didn't get catch by the normal testing because only certain project references were copied to the bin directory. The main part of this fix was to be very explicit in which assemblies are added to the TPA that are in the SOS directory instead of adding all of them. Changed the SOS managed installed to copy all the managed assemblies in SOS.NETCore to better match the dotnet-sos install layout. Changed the SOS tests to explicitly test across all the host runtimes (2.1.x, 3.1.x, 5.0.x and desktop). * Fix `dotnet-dump collect --help` ArgumentOutOfRangeException by reformatting the --type option description. * Put the version string comment in the wrong place (#1788)
1 parent 3b42f3a commit 5734230

File tree

8 files changed

+30
-19
lines changed

8 files changed

+30
-19
lines changed

eng/CreateVersionFile.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@
7373
</PropertyGroup>
7474

7575
<PropertyGroup>
76+
<!-- SOS (strike.cpp) has a dependency on this variable being public and that it begins with the @(#)Version prefix -->
7677
<NativeVersionLines>
7778
<![CDATA[
7879
char sccsid[] __attribute__((used)) = "@(#)Version $(InformationalVersion)$(BuiltByString)";

src/SOS/SOS.NETCore/CMakeLists.txt

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,8 @@ project(SOS.NETCore)
22

33
if(NOT ${CLR_MANAGED_BINARY_DIR} STREQUAL "")
44
set(MANAGED_BINDIR ${CLR_MANAGED_BINARY_DIR}/SOS.NETCore/${CLR_BUILD_TYPE}/netstandard2.0/publish)
5-
6-
install(FILES ${MANAGED_BINDIR}/SOS.NETCore.dll DESTINATION . )
7-
install(FILES ${MANAGED_BINDIR}/SOS.NETCore.pdb DESTINATION . )
8-
install(FILES ${MANAGED_BINDIR}/Microsoft.FileFormats.dll DESTINATION . )
9-
install(FILES ${MANAGED_BINDIR}/Microsoft.SymbolStore.dll DESTINATION . )
10-
install(FILES ${MANAGED_BINDIR}/System.Reflection.Metadata.dll DESTINATION . )
11-
install(FILES ${MANAGED_BINDIR}/System.Collections.Immutable.dll DESTINATION . )
5+
file(GLOB installfiles ${MANAGED_BINDIR}/*.dll ${MANAGED_BINDIR}/*.pdb)
6+
install(FILES ${installfiles} DESTINATION . )
127
endif()
138

149
if(NOT ${NUGET_PACKAGES} STREQUAL "")

src/SOS/SOS.UnitTests/ConfigFiles/Unix/Debugger.Tests.Config.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
<Option Condition="'$(RuntimeVersionLatest)' != ''">
5353
<BuildProjectFramework>$(BuildProjectFrameworkLatest)</BuildProjectFramework>
5454
<RuntimeFrameworkVersion>$(RuntimeVersionLatest)</RuntimeFrameworkVersion>
55+
<SetHostRuntime>$(DotNetRoot)/shared/Microsoft.NETCore.App/$(RuntimeFrameworkVersion)</SetHostRuntime>
5556
</Option>
5657
<Option Condition="'$(RuntimeVersion50)' != ''">
5758
<BuildProjectFramework>net5.0</BuildProjectFramework>
@@ -60,6 +61,7 @@
6061
<Option Condition="'$(RuntimeVersion31)' != ''">
6162
<BuildProjectFramework>netcoreapp3.1</BuildProjectFramework>
6263
<RuntimeFrameworkVersion>$(RuntimeVersion31)</RuntimeFrameworkVersion>
64+
<SetHostRuntime>$(DotNetRoot)/shared/Microsoft.NETCore.App/$(RuntimeFrameworkVersion)</SetHostRuntime>
6365
</Option>
6466
<Option Condition="'$(TestRuntime21)' == 'true'">
6567
<BuildProjectFramework>netcoreapp2.1</BuildProjectFramework>
@@ -77,7 +79,6 @@
7779
<Option Condition="'$(RuntimeVersionLatest)' != ''">
7880
<BuildProjectFramework>$(BuildProjectFrameworkLatest)</BuildProjectFramework>
7981
<RuntimeFrameworkVersion>$(RuntimeVersionLatest)</RuntimeFrameworkVersion>
80-
<SetHostRuntime>$(DotNetRoot)/shared/Microsoft.NETCore.App/$(RuntimeFrameworkVersion)</SetHostRuntime>
8182
</Option>
8283
<Option Condition="'$(RuntimeVersion50)' != ''">
8384
<BuildProjectFramework>net5.0</BuildProjectFramework>

src/SOS/SOS.UnitTests/ConfigFiles/Windows/Debugger.Tests.Config.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@
6868
<Option Condition="'$(RuntimeVersionLatest)' != ''">
6969
<BuildProjectFramework>$(BuildProjectFrameworkLatest)</BuildProjectFramework>
7070
<RuntimeFrameworkVersion>$(RuntimeVersionLatest)</RuntimeFrameworkVersion>
71+
<SetHostRuntime>$(DotNetRoot)/shared/Microsoft.NETCore.App/$(RuntimeFrameworkVersion)</SetHostRuntime>
7172
</Option>
7273
<Option Condition="'$(RuntimeVersion50)' != ''">
7374
<BuildProjectFramework>net5.0</BuildProjectFramework>
@@ -76,10 +77,12 @@
7677
<Option Condition="'$(RuntimeVersion31)' != ''">
7778
<BuildProjectFramework>netcoreapp3.1</BuildProjectFramework>
7879
<RuntimeFrameworkVersion>$(RuntimeVersion31)</RuntimeFrameworkVersion>
80+
<SetHostRuntime>$(DotNetRoot)/shared/Microsoft.NETCore.App/$(RuntimeFrameworkVersion)</SetHostRuntime>
7981
</Option>
8082
<Option Condition="'$(RuntimeVersion21)' != ''">
8183
<BuildProjectFramework>netcoreapp2.1</BuildProjectFramework>
8284
<RuntimeFrameworkVersion>$(RuntimeVersion21)</RuntimeFrameworkVersion>
85+
<SetHostRuntime>$(DotNetRoot)/shared/Microsoft.NETCore.App/$(RuntimeFrameworkVersion)</SetHostRuntime>
8386
</Option>
8487
<!--
8588
SOS.StackAndOtherTests (cli because tested with full, embedded and portable PDBs)
@@ -186,6 +189,7 @@
186189
<BuildProjectRuntime>win-$(TargetArchitecture)</BuildProjectRuntime>
187190
<DebugType>full</DebugType>
188191
<RuntimeSymbolsPath>$(DesktopFrameworkPath)</RuntimeSymbolsPath>
192+
<SetHostRuntime>-netfx</SetHostRuntime>
189193
</Option>
190194
</Options>
191195

src/SOS/Strike/hostcoreclr.cpp

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,15 @@ SOSNetCoreCallbacks g_SOSNetCoreCallbacks;
6363
HMODULE g_hmoduleSymBinder = nullptr;
6464
ISymUnmanagedBinder3 *g_pSymBinder = nullptr;
6565
#endif
66+
67+
static void AddFileToTpaList(const char* directory, const char* filename, std::string & tpaList)
68+
{
69+
tpaList.append(directory);
70+
tpaList.append(DIRECTORY_SEPARATOR_STR_A);
71+
tpaList.append(filename);
72+
tpaList.append(TPALIST_SEPARATOR_STR_A);
73+
}
74+
6675
//
6776
// Build the TPA list of assemblies for the runtime hosting api.
6877
//
@@ -106,11 +115,7 @@ static void AddFilesFromDirectoryToTpaList(const char* directory, std::string& t
106115
if (addedAssemblies.find(filenameWithoutExt) == addedAssemblies.end())
107116
{
108117
addedAssemblies.insert(filenameWithoutExt);
109-
110-
tpaList.append(directory);
111-
tpaList.append(DIRECTORY_SEPARATOR_STR_A);
112-
tpaList.append(filename);
113-
tpaList.append(TPALIST_SEPARATOR_STR_A);
118+
AddFileToTpaList(directory, filename.c_str(), tpaList);
114119
}
115120
}
116121
}
@@ -612,7 +617,11 @@ static HRESULT InitializeNetCoreHost()
612617

613618
// Trust The SOS managed and dependent assemblies from the sos directory
614619
std::string tpaList;
615-
AddFilesFromDirectoryToTpaList(sosModuleDirectory.c_str(), tpaList);
620+
const char* directory = sosModuleDirectory.c_str();
621+
AddFileToTpaList(directory, "System.Reflection.Metadata.dll", tpaList);
622+
AddFileToTpaList(directory, "System.Collections.Immutable.dll", tpaList);
623+
AddFileToTpaList(directory, "Microsoft.FileFormats.dll", tpaList);
624+
AddFileToTpaList(directory, "Microsoft.SymbolStore.dll", tpaList);
616625

617626
// Trust the runtime assemblies
618627
AddFilesFromDirectoryToTpaList(hostRuntimeDirectory.c_str(), tpaList);

src/SOS/Strike/strike.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10895,7 +10895,7 @@ DECLARE_API(EEVersion)
1089510895

1089610896
// Print SOS version
1089710897
#ifdef FEATURE_PAL
10898-
ExtOut("SOS Version: %s\n", sccsid);
10898+
ExtOut("SOS Version: %s\n", sccsid + sizeof("@(#)Version"));
1089910899
#else
1090010900
VS_FIXEDFILEINFO sosVersion;
1090110901
if (GetSOSVersion(&sosVersion))

src/Tools/dotnet-dump/Analyzer.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,10 @@ public async Task<int> Analyze(FileInfo dump_path, string[] command)
6363
// Add all the services needed by commands and other services
6464
AddServices(target);
6565

66-
// Set the default symbol cache to match Visual Studio's
67-
SymbolReader.DefaultSymbolCache = Path.Combine(Path.GetTempPath(), "SymbolCache");
66+
// Set the default symbol cache to match Visual Studio's when running on Windows
67+
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) {
68+
SymbolReader.DefaultSymbolCache = Path.Combine(Path.GetTempPath(), "SymbolCache");
69+
}
6870

6971
// Automatically enable symbol server support
7072
SymbolReader.InitializeSymbolStore(

src/Tools/dotnet-dump/Program.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,7 @@ private static Option DiagnosticLoggingOption() =>
7373
private static Option TypeOption() =>
7474
new Option(
7575
alias: "--type",
76-
description: @"The dump type determines the kinds of information that are collected from the process. There are several types: full - The largest dump containing all memory including the module images. heap - A large and relatively comprehensive dump containing module lists, thread lists, all stacks, exception information, handle information, and all memory except for mapped
77-
images. mini - A small dump containing module lists, thread lists, exception information and all stacks. If not specified 'full' is the default.")
76+
description: @"The dump type determines the kinds of information that are collected from the process. There are several types: Full - The largest dump containing all memory including the module images. Heap - A large and relatively comprehensive dump containing module lists, thread lists, all stacks, exception information, handle information, and all memory except for mapped images. Mini - A small dump containing module lists, thread lists, exception information and all stacks.")
7877
{
7978
Argument = new Argument<Dumper.DumpTypeOption>(name: "dump_type", getDefaultValue: () => Dumper.DumpTypeOption.Full)
8079
};

0 commit comments

Comments
 (0)