Skip to content
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

CopyDebugSymbolFilesFromPackages does not copy pdbs from runtime dir #38322

Open
SimonCropp opened this issue Jan 29, 2024 · 2 comments
Open
Assignees
Labels
Area-NetSDK untriaged Request triage from a team member

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
@dotnet-issue-labeler dotnet-issue-labeler bot 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-NetSDK untriaged Request triage from a team member
Projects
None yet
Development

No branches or pull requests

3 participants