-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Fix PerfView not load pdb #16265
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix PerfView not load pdb #16265
Conversation
|
This PR feels more like a workaround for yourself, rather than a complete fix for an issue:
Given that, I will turn this into a draft for now. |
No, I started with old version (six months old). Also there was a problem with .Net dotnet/runtime#53743
For .Net 5.0 and crossgen 1.0, PerfView generated ni.pdb files for PowerShell assemblies on the fly. I can not point a root of the issue since crossgen2.exe is not well documented. But I found a comment that now PDB files contain a reference to ni.pdb. This force me think that our crossgen process is out of date.
I measured and don't see noticeable difference (81 vs 80 ms for reading/parsing pwsh config on my notebook). I guess Newtonsoft.Json implementation is not optimized for .Net at all.
I don't know how fix right the issue with Newtonsoft.Json.dll but I am sure we should enable PublishReadyToRunEmitSymbols. Update: I have refreshed my early experiment with using System.Text.Json from .Net 5 to .Net 6.0 RC2 and now I see good perf win for ReadValueFromFile() ~4x. |
|
@daxian-dbw After thinking more I am sure the PublishReadyToRunEmitSymbols must be added to 7.2 release otherwise we will distribute "broken" PDB files. |
|
I will take a look tomorrow. The 7.2-rc.1 release build already started, but if this is proven to be really needed, we may still have time to include it in the GA release. |
daxian-dbw
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right, profiler needs the symbols generated by <PublishReadyToRunEmitSymbols> to examine the R2R files. However, those symbols are only useful for profiling the startup scenario of PowerShell because PowerShell enables tiered compilation which will overwrite the R2R code.
Given that it's a very specific dev scenario, I don't think we should always generate the native symbols when build and publish R2R images. Instead, there should be a switch parameter to Start-PSBuild -CreateR2RSymbols to turn it on when needed.
| <TargetFramework>net6.0</TargetFramework> | ||
| <LangVersion>10.0</LangVersion> | ||
| <PublishReadyToRun Condition=" '$(Configuration)' != 'Debug' ">true</PublishReadyToRun> | ||
| <PublishReadyToRunEmitSymbols>true</PublishReadyToRunEmitSymbols> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| <PublishReadyToRunEmitSymbols>true</PublishReadyToRunEmitSymbols> | |
| <PublishReadyToRunEmitSymbols Condition=" '$(Configuration)' != 'Debug' And '$(CreateR2RSymbols)' == '1'">true</PublishReadyToRunEmitSymbols> |
|
This doesn't need to be included in 7.2 GA. PowerShell packages don't ship pdb files anyways. |
It is not only for startup scenario. It is for all scenarios including hosting. (User should disable TC)
I think they distributed by Microsoft Symbol servers. If no it must be. Also I guess .Net are migrating to portable pdb format where possible dotnet/runtime#45492 We run still crossgen for standard .Net dll-s. I think it should be removed. Lines 2498 to 2499 in 612aade
|
PowerShell nuget packages use IL assemblies, not R2R images. So applications that hosting powershell using NuGet packages don't have this problem. They can choose to publish R2R images for their applications though, but that's nothing to do with the powershell build. Today PowerShell symbols are not distributed by any symbol servers. It's in our backlog.
Does |
It is already in PowerShell.Common.props - for compliance and release build there are different conditions. |
Yes, .Net 6.0 dll-s are already in R2R format. |
Can you share the link to the documentation/issue/blog that confirms this? I have been assuming this but couldn't find an official confirmation. As for portable pdb, I will leave it to @TravisEz13 to comment. |
|
That's perfect! I have been looking for ways to deterministically know if an assembly is R2R image! It seems the following 3 assemblies (at least) are not R2R image: Can you verify with ILSpy? |
|
Only System.IO.FileSystem.Primitives.dll is not crossgen2 as ILSpy shows. Perhaps PublishReadyToRun does crossgen for PowerShell. Will ask in Runtime. |
|
You need switch from C# to ReadyToRun in menu |
|
Issue in .Net Runtime dotnet/runtime#60779 |
|
System.IO.FileSystem.Primitives.dll is compiled for AnyCPU. So it can not be in R2R :-) |
Thanks! You are using 7.2-preview.1. I see the
Yeah. both The .NET team has confirmed that ALL .NET 6 runtime assemblies should be R2R images. I have also verified that Given all above, I think we consider removing the |


PR Summary
Latest PerfView doesn't load PDB files for PowerShell assemblies (SMA and other) without the fix.
After adding PublishReadyToRunEmitSymbols I had to exclude NewtonSoft.JSON.dll from processing by crossgen2.exe because this broke PDB loading.
PR Context
PR Checklist
.h,.cpp,.cs,.ps1and.psm1files have the correct copyright headerWIP:or[ WIP ]to the beginning of the title (theWIPbot will keep its status check atPendingwhile the prefix is present) and remove the prefix when the PR is ready.(which runs in a different PS Host).