-
Notifications
You must be signed in to change notification settings - Fork 255
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
Full development cycle with Symbols #10793
Comments
There may be some additional context into symbols here as well: https://github.com/NuGet/docs.microsoft.com-nuget/issues/2343 |
I haven't had time to look in detail, but I see a slight misunderstanding of how symbols currently work. When you push snupks to nuget.org, it unzips the pdbs and sends them to a symbol server. Then when debugging, the debugger (VS or windbg, or whatever else) talk use the symbols protocol (that existed a long time before NuGet was ever created) to download the pdbs. Debuggers in fact know nothing about NuGet or snupkgs. Your proposal basically is taking the HTTP symbol server out of the equation. I think you're proposing that restore should copy the pdbs locally, so there's "never" a need to download pdbs from a symbol server. However:
This appears to be a feature request that affects multiple components of the .NET ecosystem, so perhaps a proposal in github.com/dotnet/designs is warranted, as it might require product changes outside of NuGet.
yes, please don't spend effort implementing something for a design that is not approved. Since this is not work we planned in advance, we don't necessarily have time to review and give feedback in short notice. Especially when the request requires cross-team collaboration. I know it's frustrating that this makes the process slower, but it is what it is. |
Initial issue text was updated.
Yes it is. https://api.nuget.org/v3/index.json {
"version": "3.0.0",
"resources": [
{
"@id": "https://www.nuget.org/api/v2/symbolpackage",
"@type": "SymbolPackagePublish/4.9.0",
"comment": "The gallery symbol publish endpoint."
}
]
} Pushed symbols package can be directly downloaded via link
Same structure in MyGet and BaGet. NuGet have functionality to push snupkg but not restore.
You are right. v3 project structure requires additional handling. What else is incorrect? From my point of view we need to implement restore functionality at least for v2 at start (maintain symbols package cache as well). It will allow to update v3 PackageReference with additional package and symbols merge logic (based not on satellites but on different sources from cache) |
For the V3 protocol support for .snupkg files I will make one clarification:
It is true there is a standard protocol for uploading (a.k.a. pushing) .snupkg files. The official documentation for what you describe is here: https://docs.microsoft.com/en-us/nuget/api/symbol-package-publish-resource However, the is no official protocol for downloading the .snupkg. In fact, the only reason the nuget.org has a way to download .snupkg files after pushing is to enable the web UI link on the package details page: If we want some NuGet client-based flow for PDB downloading, I think we would have to add something new to the protocol. I see two options:
(This is a just a straw man to demonstrate what is missing, not much more 😄) |
This issue was created exactly for this purpose - determine what is missing. :) Ok let's describe symbols restore feature separately for v2 and v3 C# projects: V2 project
<Reference Include="<assembly name>">
<HintPath>..\packages\package_id.package_version>\lib\platform\assembly_name.dll</HintPath>
</Reference>
Cases:
NuGet web registry - requires new service index NuGet (any local tool) - can be implemented right now MSBuild NuGet local registry - can be implemented right now V3 project
<PackageReference Include="<package id>" Version="<package version>" />
Cases:
NuGet web registry - requires new service index NuGet (any local tool) - can be implemented right now MSBuild NuGet local registry - can be implemented right now So right now we can implement at least 1 case(v2.1) end to end. In case of implementation NuGet protocol will be able to use snupkg from local folders and process cache. |
I just want to set expectations here because the challenges are not just technical. That being said, I love the write-up! Thanks for getting this conversation going! |
Will describe my vision of symbols restore process for clients. What to addOptions that will force to restore snupkg as well as nupkg.
For proper integration into real project - symbols restore configuration must be placed in new file (similar to nuget.config for example nuget.config.user) on solution level. It is crucial to have ability to exclude it from subversion. Inside Visual Studio in the NuGet Package Manager on Installed tab for every package add option for symbols install as well (configuration placed in nuget.config.user). Built-in Restore mechanism will respect this option in same way as common package miss situation. What it will donuget.exe restore and dotnet restore commands will do their job with symbols restore option only for configured packages. Based on source project version above commands will:
Further symbols transport will be handled by MSBuild. In old project structure symbols will be copied as assembly satellites to output folder and in new project structure this action will be handled by Also it is important to implement symbols discovery operation in registries independent from package registries. This will allow to place .snupkg files in local NuGet folder (local file based registry). Debug flow exampleDisposition:
In order to debug application properly developer will:
|
@nkolev92 what do you think about above flow? |
We should make improvements to symbols and debugging experience, so don't interpret this as avoiding any change. But if you're looking for a way to do debugging with tools available today, I just remembered that BaGet has a built-in symbol server. Use this for your company internal NuGet feed, and I believe you can get it working. |
I want to improve local PC debug experience at the end :) all things above are first steps that are missed. NuGet have artifacts split functionality but have no merge. But merge process will allow a lot of additional things for proper develop experience. You are right, somehow with third party solutions I am able to inject in some way symbols. But I want to use NuGet. I can use local folder as a registry, but I can't use well defined snupkg format to force application debugging with visual studio. It is required to host symbol server as well not just a simple folder with downloaded snupkg. |
Any thoughts about above flow @zivkan? Look, I know you all have user stories from your PMs and this feature is complex. Moreover it comes from community. I don't ask you to develop it. I'm only asking you to have a discussion about the concept itself. I do understand this this will take a lot of your time and effort but believe that this functionality is crucial for NuGet's future. Initial text describes all cases and they involve teams beside NuGet. But there is one case which can bring core implementation into NuGet without impacting other teams. Later, other teams will be able to use NuGet API for their work if necessary. Please, let me know how you feel about it. |
I'm super busy with multiple urgent issues, so I haven't had time to look into this in detail. My overview is that this proposal is basically going to change NuGet to download and extract snupks in the global packages folder & solution packages folder on restore, and then hope the rest of the build tools make debugging work nice. This is "easy" enough for local package sources, since we own the code that checks the files on disk. HTTP sources is going to be much more difficult because it's going to need a protocol change (and eventually update our protocol docs). While we (client team) can work with the nuget.org server team to get these changes implemented for nuget.org, it's going to up to Azure Artifacts, GitHub Package Repository, myget, Artifactory, and all nuget protocol server implementations to discover that the protocol has been extended and implement it, if they wish. If any of those servers don't implement the new "snupkg download" resource, then developers won't get an improved debugging experience, but they'll be no worse off than they are now. Also, this is likely to only benefit packages.config customers. PackageReference will probably need #5926 fixed. A risk is any tool that expects the packages folder to contain the same contents as the nupkg, plus the two generated files (minus the generated OPC files in the nupkg that aren't extracted). There's no official tooling that does this, so it probably won't affect most customers, but anyone who does have custom tooling to detect tampered package directories will be unpleasantly surprised. An alternative would be to extract symbols in a different directory (for example, This is all the time I can spend on this issue today. |
@JonDouglas this looks like something we should look at from a customer development perspective, and figure out what actions to take from there. Do you mind taking a look? Andy and Nikolche can help with context/clarification. :) |
@zivkan thank you! I really appreciate your effort to this despite being busy! As an intermediate conclusion:
Theoretically, if I publish PR which covers above conclusion will you able to review and accept it? PR will include:
Or this complex functionality must be done in another way? |
An internal email thread made me realize that snupkgs currently do not get signed. If NuGet is going to start reading these files (currently it's write-only), then we need to consider whether we need to make snupkgs signed as well to mitigate the same risks that signed nupkgs mitigate. I really, really don't want to add scope creep, but security is security. |
From my point of view NuGet container (for generic packages and for symbols) must be identical (security implementation as well). Basically snupkg is the same nupkg but with limited content and limited metadata. Even more - existing sign mechanism is working with snupkg (just checked). Download, extract and install implementations will be identical to generic nupkg. |
My short opinion: It is not theme for consideration. snupkg MUST be safe |
Ok, hopefully this just means that the internal team's CI pipeline has a bug where they're not signing their snupkgs. |
Currently snupkgs are common zip archive with pdb inside. There are no suggestions how to work with them. All NuGet tools have no additional functionality to work with so nobody signing snupkg because it useless (for proper work you need to download it, unpack content and manually add symbols to output folder). One place that can validate signature is NuGet.org (hope they do this) before Symbols server populate. @zivkan what about PR? |
The burden here is not technical, but UX. We appreciate your willingness to do the work here, but I'd encourage you to wait for a confirmation from us before spending time on the implementation. |
@nkolev92 can you comment above question? |
We are not ready to make a call at this point. Sorry about that. Someone from the team will loop back when ready. |
Hey @BlackGad, Firstly, thank you so much for the extremely thought out scenario & interest in contributing to NuGet! We are trying to move our proposal process to a more unified & streamlined model so we can take ample time to review as a community & team to decide whether we can support the proposal. If you're willing to condense this issue into a proposal, we can dedicate some time to review it and amplify it within the .NET community for others to comment on. https://github.com/NuGet/Home/tree/dev/meta#how-do-i-create-a-proposal |
@JonDouglas here you are #10899 . Hope I've created it in proper manner. Let me know if something missed or described badly. |
@BlackGad Thank you kindly. I'll comment over there now! |
I'd like to tag onto this issue for a related problem. I'd like the "dotnet publish" command to be able to include the debug symbols of the project's dependent NuGet packages, so that the .NET exception callstack would include the line number. Here's my scenario:
Wish: LibraryA.pdb would get copied to the publish-output directory (because LibraryA.pdb is in the NuGet package and is also available in the local machine's NuGet cache). The reason I'd like to bring this up is that it seems like "dotnet publish" does not automatically copy all the files available in the build output directory. I've tried the following steps:
Wish: LibraryA.pdb would be copied to publish-output, given that it is in ServiceB's build output directory. Thanks for your consideration! |
But seems you are missed Read explanation. Is it looks like described scenario? |
@BlackGad Thanks for your detailed explanation! Truly appreciate it! My scenario is 1. ii. (team A pack pdb into generic
For now, team B's been working around the problem by copying the relevant .pdb from the NuGet cache directory to the publish-output directory (the output dir of Glad to hear that the long-term solution will be implemented for |
@LowCarbonGuy <Target Name="Copy assemblies satellite symbols" AfterTargets="ResolveAssemblyReferences">
<ItemGroup>
<SymbolsSatelliteFiles Include="@(ReferenceCopyLocalPaths->'%(RootDir)%(Directory)%(Filename).pdb')" Condition="$([System.IO.File]::Exists('%(RootDir)%(Directory)%(Filename).pdb'))"/>
<ReferenceCopyLocalPaths Include="@(SymbolsSatelliteFiles)"/>
</ItemGroup>
</Target> Paste this to your *.csproj file ;) |
Details about Problem
NuGet system implementation currently has almost all parts for full development cycle with symbols.
This is basically first stop on the long road to resolving target issue #6579.
So lets start with stages of full development cycle:
Current implementation state
Create and publish
This stage fully implemented. Tools and applications which uses NuGet can pack binaries into packages accordingly to nuspec configuration. With additional options they can automatically create snupkg symbols packages. Also v3 web registries can consume binary AND symbols packages for future usage.
From technical perspective both .nupkg and .snupkg similar because same code used for their creation (just minor nuspec changes and exclude filters).
Update: Official NuGet registry reformat snupkg package internally to Symbols artifact for built-in Symbols server
Restore and build
Stage begins from restore step. Tools and applications restores existing (install new ones) packages into specific folder to allow builder (Visual Studio on a picture) compose real application. NuGet protocol(framework) has built in discovery and cache mechanisms that why actual tools do not care about implementation. Everything what they must to do is call proper API methods.
Launch and debug
Executing our binaries and attach debugger (Visual Studio here). In order to debug external binaries it is required to load their symbols.
Generic approach for Visual Studio is to use symbols from only one of three places:
Picture above describes current Visual Studio integration for .snupkg (Option 3). Visual Studio downloads from existing NuGet symbol server Symbols and map them to actual runtime.
Issues
Purposed implementation
We need to use Visual Studio The same folder as the DLL or .exe file pdb discovery feature.
Create and publish
Already ready for usage.
Restore and build
Main difference here is handling snupkg packages as generic nupkg.
This means:
When all symbols placed near binaries Visual Studio (MSBuild actually but whatever) will copy them to target folder.
Launch and debug
Magically there will be no additional NuGet specific logic for symbols. Visual Studio will resolve pdb files which placed near the binaries.
Purpose
Main purpose of this issue to begin discussion prior to Nuget/Home documentation PR and actual implementation.
Existing covered issues
#9667
#9456
#1696
Discovered problems
PackageReference do not support satellite files copy (.pdb and .xml files). #5926
The text was updated successfully, but these errors were encountered: