Skip to content

CopyDebugSymbolFilesFromPackages does not copy pdbs from runtime dir #38322

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

Open
SimonCropp opened this issue Jan 29, 2024 · 7 comments
Open
Milestone

Comments

@SimonCropp
Copy link
Contributor

SimonCropp commented Jan 29, 2024

given the following project

<Project Sdk="Microsoft.NET.Sdk">
    <PropertyGroup>
        <OutputType>Exe</OutputType>
        <TargetFramework>net8.0</TargetFramework>
        <CopyDebugSymbolFilesFromPackages>true</CopyDebugSymbolFilesFromPackages>
    </PropertyGroup>
    <ItemGroup>
      <PackageReference Include="Microsoft.Data.SqlClient" Version="5.1.4" />
    </ItemGroup>
</Project>

the directory bin\Release\net8.0\runtimes\win\lib\net6.0 does not contain any pdbs

image

but the package does have a pdb in that dir

image

Machine:

  • sdk 8.0.101
  • Windows 11 Enterprise 23H2
  • Rider 2023.3.3
@ghost ghost added Area-NetSDK untriaged Request triage from a team member labels Jan 29, 2024
@SimonCropp SimonCropp changed the title CopyDebugSymbolFilesFromPackages dores not copy pdb from runtime dir CopyDebugSymbolFilesFromPackages does not copy pdb from runtime dir Jan 29, 2024
@SimonCropp SimonCropp changed the title CopyDebugSymbolFilesFromPackages does not copy pdb from runtime dir CopyDebugSymbolFilesFromPackages does not copy pdbs from runtime dir Jan 29, 2024
@SimonCropp
Copy link
Contributor Author

SimonCropp commented Jan 29, 2024

for anyone else who gets here, this is current approach i am using to get all the pdbs

  <Target Name="IncludeSymbolFromReferences"
          AfterTargets="ResolveAssemblyReferences"
          Condition="@(ReferenceCopyLocalPaths) != ''">
    <ItemGroup>
      <PdbFilesToAdd
              Include="%(ReferenceCopyLocalPaths.RelativeDir)%(ReferenceCopyLocalPaths.Filename).pdb"
              DestinationSubDirectory="%(ReferenceCopyLocalPaths.DestinationSubDirectory)" />
      <PdbFilesToAdd Remove="@(PdbFilesToAdd)"
                     Condition="!Exists('%(FullPath)')" />
      <ReferenceCopyLocalPaths Include="@(PdbFilesToAdd)" />
    </ItemGroup>
  </Target>

@KalleOlaviNiemitalo
Copy link
Contributor

NuGet does not output "related" within "runtimeTargets" into project.assets.json like this:

      "Microsoft.Data.SqlClient/5.1.4": {
        "type": "package",
        "dependencies": {
          "Azure.Identity": "1.10.3",
          "Microsoft.Data.SqlClient.SNI.runtime": "5.1.1",
          "Microsoft.Identity.Client": "4.56.0",
          "Microsoft.IdentityModel.JsonWebTokens": "6.24.0",
          "Microsoft.IdentityModel.Protocols.OpenIdConnect": "6.24.0",
          "Microsoft.SqlServer.Server": "1.0.0",
          "System.Configuration.ConfigurationManager": "6.0.1",
          "System.Diagnostics.DiagnosticSource": "6.0.1",
          "System.Runtime.Caching": "6.0.0",
          "System.Security.Cryptography.Cng": "5.0.0",
          "System.Security.Principal.Windows": "5.0.0",
          "System.Text.Encoding.CodePages": "6.0.0",
          "System.Text.Encodings.Web": "6.0.0"
        },
        "compile": {
          "ref/net6.0/Microsoft.Data.SqlClient.dll": {
            "related": ".pdb;.xml"
          }
        },
        "runtime": {
          "lib/net6.0/Microsoft.Data.SqlClient.dll": {
            "related": ".pdb;.xml"
          }
        },
        "runtimeTargets": {
          "runtimes/unix/lib/net6.0/Microsoft.Data.SqlClient.dll": {
            "assetType": "runtime",
            // NuGet omits "related": ".pdb",
            "rid": "unix"
          },
          "runtimes/win/lib/net6.0/Microsoft.Data.SqlClient.dll": {
            "assetType": "runtime",
            // NuGet omits "related": ".pdb",
            "rid": "win"
          }
        }
      },

And even if did, the ResolvePackageAssets task in .NET SDK would ignore those.

Is .NET SDK is supposed to get the "related" property from within "runtime" and apply it to equally-named assets within "runtimeTargets" as well? I guess it isn't, because the package has no "*.xml" files within the "runtimes" directory; if the SDK reused the "related" property, it would need to check for file existence rather than rely on project.assets.json listing the exact files. The Consuming pdb support with PackageReference spec does not mention runtime-specific related files.

@marcpopMSFT marcpopMSFT self-assigned this Feb 6, 2024
@marcpopMSFT marcpopMSFT added needs team triage Requires a full team discussion and removed untriaged Request triage from a team member labels Apr 7, 2025
@marcpopMSFT
Copy link
Member

Triage: This works for runtime items but not for platform-specific items. This would require work from NuGet @aortiz-msft @nkolev92. Moving to backlog for now as there is a workaround listed above of copying yourself.

@marcpopMSFT marcpopMSFT removed the needs team triage Requires a full team discussion label Apr 8, 2025
@marcpopMSFT marcpopMSFT removed their assignment Apr 8, 2025
@marcpopMSFT marcpopMSFT added this to the Backlog milestone Apr 8, 2025
@SimonCropp
Copy link
Contributor Author

@marcpopMSFT please dont move this to the backlog. the workaround is very difficult to discover when the symptom is "missing line numbers in production stack traces"

@nkolev92
Copy link
Contributor

nkolev92 commented Apr 9, 2025

@marcpopMSFT
Copy link
Member

Ahh, so just a fix needed on the nuget side might be enough. That's good to here. @SimonCropp willing to file a copy of this work item in the nuget repo so we can close this out?

@SimonCropp
Copy link
Contributor Author

@marcpopMSFT it would be less work if you can move the issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants