From a64e671a8b99db0a92e1e1b3a97eb31fd973e42b Mon Sep 17 00:00:00 2001 From: Nick Guerrera Date: Wed, 1 Nov 2017 17:15:52 -0700 Subject: [PATCH 1/6] Don't crossgen satellite assemblies --- src/redist/redist.csproj | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/redist/redist.csproj b/src/redist/redist.csproj index c45cd6bdf..0d0f1b7e1 100644 --- a/src/redist/redist.csproj +++ b/src/redist/redist.csproj @@ -208,6 +208,9 @@ + + + From 116da0277c0bfb3211165d4a7d1527fa7f05ae94 Mon Sep 17 00:00:00 2001 From: Nick Guerrera Date: Wed, 1 Nov 2017 17:17:22 -0700 Subject: [PATCH 2/6] Generate symbols for profiling when running crossgen --- build_projects/dotnet-cli-build/Crossgen.cs | 35 +++++++++++++++++++++ src/redist/redist.csproj | 5 +++ 2 files changed, 40 insertions(+) diff --git a/build_projects/dotnet-cli-build/Crossgen.cs b/build_projects/dotnet-cli-build/Crossgen.cs index 68129a065..48ebdebfa 100644 --- a/build_projects/dotnet-cli-build/Crossgen.cs +++ b/build_projects/dotnet-cli-build/Crossgen.cs @@ -3,7 +3,9 @@ // See the LICENSE file in the project root for more information. using System; +using System.Diagnostics; using System.IO; +using System.Runtime.InteropServices; using Microsoft.Build.Framework; using Microsoft.Build.Utilities; @@ -22,12 +24,18 @@ namespace Microsoft.DotNet.Build.Tasks public string CrossgenPath { get; set; } + public bool CreateSymbols { get; set; } + + public string DiasymReaderPath { get; set; } + public bool ReadyToRun { get; set; } public ITaskItem[] PlatformAssemblyPaths { get; set; } private string TempOutputPath { get; set; } + private bool _secondInvocationToCreateSymbols; + protected override bool ValidateParameters() { base.ValidateParameters(); @@ -58,6 +66,12 @@ namespace Microsoft.DotNet.Build.Tasks File.Delete(TempOutputPath); } + if (toolResult && CreateSymbols) + { + _secondInvocationToCreateSymbols = true; + toolResult = base.Execute(); + } + return toolResult; } @@ -83,9 +97,30 @@ namespace Microsoft.DotNet.Build.Tasks protected override string GenerateCommandLineCommands() { + if (_secondInvocationToCreateSymbols) + { + return $"{GetReadyToRun()} {GetPlatformAssemblyPaths()} {GetDiasymReaderPath()} {GetCreateSymbols()}"; + } + return $"{GetReadyToRun()} {GetInPath()} {GetOutPath()} {GetPlatformAssemblyPaths()} {GetJitPath()}"; } + private string GetCreateSymbols() + { + var option = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? "-createpdb" : "-createperfmap"; + return $"{option} \"{Path.GetDirectoryName(DestinationPath)}\" \"{DestinationPath}\""; + } + + private string GetDiasymReaderPath() + { + if (string.IsNullOrEmpty(DiasymReaderPath)) + { + return null; + } + + return $"-diasymreaderpath \"{DiasymReaderPath}\""; + } + private string GetReadyToRun() { if (ReadyToRun) diff --git a/src/redist/redist.csproj b/src/redist/redist.csproj index 0d0f1b7e1..ded13959e 100644 --- a/src/redist/redist.csproj +++ b/src/redist/redist.csproj @@ -211,6 +211,8 @@ + + @@ -235,6 +237,8 @@ JITPath="$(LibCLRJitPath)" CrossgenPath="$(CrossgenPath)" ReadyToRun="True" + CreateSymbols="True" + DiasymReaderPath="@(DiasymReaderPath)" PlatformAssemblyPaths="@(PlatformAssemblies); @(PublishDirSubDirectories); $(SharedFrameworkNameVersionPath)" /> @@ -265,6 +269,7 @@ AfterTargets="CreateSymbolsDirectory"> + From 607907c67da7fb6466f7a325da9b4d81192e9cec Mon Sep 17 00:00:00 2001 From: Nick Guerrera Date: Thu, 2 Nov 2017 15:05:24 -0700 Subject: [PATCH 3/6] Retarget VSTest before publishing with backward compatible runtimes --- src/redist/redist.csproj | 1 + 1 file changed, 1 insertion(+) diff --git a/src/redist/redist.csproj b/src/redist/redist.csproj index ded13959e..37dbadb3a 100644 --- a/src/redist/redist.csproj +++ b/src/redist/redist.csproj @@ -293,6 +293,7 @@ $(PublishDir)/vstest.console.runtimeconfig.json From 4f31e3db6690b5f67710bcc75eb10f718940e5a2 Mon Sep 17 00:00:00 2001 From: Nick Guerrera Date: Thu, 2 Nov 2017 10:07:11 -0700 Subject: [PATCH 4/6] Improve symbols zip archive We were publishing a -debug zip with sdk code and symbols, but it was captured before publishing was finished and had incorrect code content. Trying to use it would blow up due to incorrect runtimeconfig.json. Replace it with a -symbols zip that contains only symbols and that can be overlayed over the main zip. This is just like the -langpack zip that has satellite assemblies. Also add an option to leave the PDBs in the same directory/packages as code: /p:SeparateSymbolsArchive=false. Setting this on local builds facilitates debugging and profiling by removing the need to adjust symbol paths or copy PDBs around. --- build/Branding.props | 4 ++-- build/package/Layout.targets | 20 ++++++++++---------- src/redist/redist.csproj | 27 ++++++++++----------------- 3 files changed, 22 insertions(+), 29 deletions(-) diff --git a/build/Branding.props b/build/Branding.props index 9a66fdc2d..7b126782e 100644 --- a/build/Branding.props +++ b/build/Branding.props @@ -21,14 +21,14 @@ $(HostOSName)-$(Architecture) dotnet-sdk-internal - dotnet-sdk-debug + dotnet-sdk-symbols dotnet-sdk $(ArtifactNameCombinedHostHostFxrFrameworkSdk)-langpack $(ArtifactNameSdk)-$(SdkVersion)-$(ProductMonikerRid) dotnet-standard-support-vs2015-$(SdkVersion)-$(ProductMonikerRid) - $(ArtifactNameSdkDebug)-$(SdkVersion)-$(ProductMonikerRid) + $(ArtifactNameSdkSymbols)-$(SdkVersion)-$(ProductMonikerRid) $(ArtifactNameCombinedHostHostFxrFrameworkSdk)-$(SdkVersion)-$(ProductMonikerRid) $(ArtifactNameSdkLanguagePack)-$(SdkVersion)-$(ProductMonikerRid) $(ArtifactNameCombinedHostHostFxrFrameworkSdk)-$(SdkVersion)-$(HostMonikerRid) diff --git a/build/package/Layout.targets b/build/package/Layout.targets index 8d37a5b36..e59186202 100644 --- a/build/package/Layout.targets +++ b/build/package/Layout.targets @@ -1,7 +1,7 @@ - $(LayoutDirectory)/$(ArtifactNameSdkDebug) + $(LayoutDirectory)/$(ArtifactNameSdkSymbols) $(LayoutDirectory)/$(ArtifactNameCombinedHostHostFxrFrameworkSdk) $(LayoutDirectory)/$(ArtifactNameSdkLanguagePack) *.resources.dll @@ -12,7 +12,7 @@ - + @@ -30,9 +30,9 @@ - + Path1="$(SymbolsDirectory)/" + Path2="%(SdkSymbolsLayoutInput.Identity)" > + $(ArtifactNameSdk) - - @(SdkDebugLayoutInput) - @(SdkDebugRelativeOutputFiles -> '$(SdkDebugLayoutOutputDirectory)/%(Identity)') - $(ArtifactNameWithVersionSdkDebug) - $(ArtifactNameSdkDebug) + + @(SdkSymbolsLayoutInput) + @(SdkSymbolsRelativeOutputFiles -> '$(SdkSymbolsLayoutOutputDirectory)/%(Identity)') + $(ArtifactNameWithVersionSdkSymbols) + $(ArtifactNameSdkSymbols) diff --git a/src/redist/redist.csproj b/src/redist/redist.csproj index 37dbadb3a..fab6164c5 100644 --- a/src/redist/redist.csproj +++ b/src/redist/redist.csproj @@ -101,7 +101,8 @@ + $(PublishDir)/%(BundledToolProjects.Identity).dll; + $(PublishDir)/%(BundledToolProjects.Identity).pdb" /> + AfterTargets="GenerateCliRuntimeConfigurationFiles"> @@ -255,24 +256,16 @@ - + - <_AllSdkFiles Include="$(PublishDir)/**/*" /> + + - - - - - - - - - - + Date: Thu, 2 Nov 2017 16:35:29 -0700 Subject: [PATCH 5/6] Don't attempt to generate profiling symbols on Mac OS --- src/redist/redist.csproj | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/redist/redist.csproj b/src/redist/redist.csproj index fab6164c5..b8e179c3b 100644 --- a/src/redist/redist.csproj +++ b/src/redist/redist.csproj @@ -233,12 +233,18 @@ Glob="$(CrossgenPath)" Mode="u+x" /> + + + true + false + +