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

Add output DebugSymbolsFiles to ResolvePackageAssets #27580

Merged
merged 2 commits into from
Sep 12, 2022

Conversation

ocallesp
Copy link
Contributor

@ocallesp ocallesp commented Aug 31, 2022

fixes #1458

DebugSymbolsFiles outputs the list of absolute path to symbols files (.pdb) from runtime assemblies.
ReferenceDocumentationFiles outputs the list of absolute path to xml files that enables debugging features.

The change:
Added DebugSymbolsFiles and ReferenceDocumentationFiles and ResolvePackagesAssets was modified to read/write DebugSymbolsFiles and ReferenceDocumentationFiles from/to the cache file.

The debug symbols files will be copied to the output directory when CopyDebugSymbolFilesFromPackages quals to true.

The reference documentation files will be copied to the output directory when CopyDocumentationFilesFromPackages quals to true.


For manual testing, I was using this sample project #1383 and checking that the pdb are copied to the output directory of the consumer.

@ocallesp ocallesp requested a review from dsplaisted August 31, 2022 02:05
@ocallesp ocallesp force-pushed the githubFix1458 branch 2 times, most recently from 6c1a9d0 to 7e9e95b Compare August 31, 2022 02:08
@ocallesp ocallesp self-assigned this Aug 31, 2022
@ocallesp ocallesp requested a review from marcpopMSFT August 31, 2022 02:53
@ocallesp ocallesp force-pushed the githubFix1458 branch 7 times, most recently from 04f38a1 to 75b67c4 Compare August 31, 2022 18:34
@dsplaisted
Copy link
Member

Thanks @ocallesp, this is a good start. Can you rebase and retarget this PR to the release/7.0.1xx branch?

Other feedback:

  • I think there should be separate output items on the task for the PDB and XML files. The XML files should only be included in the publish output if PublishReferencesDocumentationFiles is true (I think that for the build output they should always be included).
  • The XML files should come from the compile assets in the project.assets.json file, not the runtime assets.

Here's a sample assets file:

  "targets": {
    "net7.0": {
      "LibraryTest/1.0.0": {
        "type": "package",
        "compile": {
          "ref/net7.0/LibraryTest.dll": {
            "related": ".xml"
          }
        },
        "runtime": {
          "lib/net7.0/LibraryTest.dll": {
            "related": ".pdb"
          }
        }
      },
      "Newtonsoft.Json/4.5.4": {
        "type": "package",
        "compile": {
          "lib/net40/Newtonsoft.Json.dll": {
            "related": ".pdb;.xml"
          }
        },
        "runtime": {
          "lib/net40/Newtonsoft.Json.dll": {
            "related": ".pdb;.xml"
          }
        }
      }
    }
  },

@ocallesp
Copy link
Contributor Author

Thanks @ocallesp, this is a good start. Can you rebase and retarget this PR to the release/7.0.1xx branch?

Other feedback:

  • I think there should be separate output items on the task for the PDB and XML files. The XML files should only be included in the publish output if PublishReferencesDocumentationFiles is true (I think that for the build output they should always be included).
  • The XML files should come from the compile assets in the project.assets.json file, not the runtime assets.

Here's a sample assets file:

  "targets": {
    "net7.0": {
      "LibraryTest/1.0.0": {
        "type": "package",
        "compile": {
          "ref/net7.0/LibraryTest.dll": {
            "related": ".xml"
          }
        },
        "runtime": {
          "lib/net7.0/LibraryTest.dll": {
            "related": ".pdb"
          }
        }
      },
      "Newtonsoft.Json/4.5.4": {
        "type": "package",
        "compile": {
          "lib/net40/Newtonsoft.Json.dll": {
            "related": ".pdb;.xml"
          }
        },
        "runtime": {
          "lib/net40/Newtonsoft.Json.dll": {
            "related": ".pdb;.xml"
          }
        }
      }
    }
  },

If we apply this change to release/7.0.1xx branch, does the pipeline/insertions also apply this change to main ?

@ocallesp ocallesp changed the base branch from main to release/7.0.1xx August 31, 2022 23:44
@dsplaisted
Copy link
Member

If we apply this change to release/7.0.1xx branch, does the pipeline/insertions also apply this change to main ?

Yes, the code will eventually flow forward to later branches.

@ocallesp ocallesp marked this pull request as ready for review September 1, 2022 01:45
@ocallesp ocallesp force-pushed the githubFix1458 branch 3 times, most recently from fd97481 to 1722738 Compare September 1, 2022 19:45
Copy link
Member

@dsplaisted dsplaisted left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good so far.

@ocallesp ocallesp force-pushed the githubFix1458 branch 2 times, most recently from 8eff3f6 to 25590b0 Compare September 8, 2022 22:06
@ocallesp
Copy link
Contributor Author

ocallesp commented Sep 8, 2022

@dsplaisted
Copying pdb and xml to output and publish directories are now disable by default.

  • The debug symbols files will be copied to the output directory when CopyDebugSymbolFilesFromPackages quals to true.

  • The reference documentation files will be copied to the output directory when CopyDocumentationFilesFromPackages quals to true.

DebugSymbolsFiles outputs the list of absolute path to symbols files
for package references.
ReferenceDocumentationFiles outputs the list of absolute path to Xml
documentation files.

The change:
ResolvePackagesAssets was modified to read/write DebugSymbolsFiles
and ReferenceDocumentationFiles from/to the cache file. They were inserted
after ContentFilesToProcess to keep the alphabetical order.

The target was modified to copy the DebugSymbolsFiles to output
directory only when CopyDebugSymbolFilesFromPackages is true, and
ReferenceDocumentationFiles to the output directory when
EnableCopySymbolsAndXmlDocsToOutputDir is true.

There is some minor code cleanup not related to this bug.
@ocallesp
Copy link
Contributor Author

ocallesp commented Sep 9, 2022

@dsplaisted changes done as suggested.

@ocallesp ocallesp force-pushed the githubFix1458 branch 4 times, most recently from d9f14b4 to 0231a17 Compare September 9, 2022 20:28
Copy link
Member

@dsplaisted dsplaisted left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking very good, and pretty close to done I think. Thanks!

@dsplaisted
Copy link
Member

@baronfel, What do you think about the property names CopyDebugSymbolFilesFromPackages and CopyDocumentationFilesFromPackages? Should we consider something like CopyPdbFilesFromPackages and CopyXmlFilesFromPackages? The current names try to match the existing PublishReferencesDocumentationFiles property.

Also pinging @dotnet/dotnet-cli in case anyone else has feedback.

…ectory

- Testing CopyDebugSymbolFilesFromPackages and CopyDocumentationFilesFromPackagesAdd unit-tests for EnableCopySymbolsAndXmlDocsToOutputDir
@baronfel
Copy link
Member

I'm ok with the current names - I'd rather align with the existing terminology to stay consistent. The PublishDocumentationFile(s) and PublishReferencesDocumentationFiles properties don't seem to be documented yet, so when this changes I'll bundle documenting them and these new properties in a single PR to dotnet/docs so that we're up-to-date and maybe get some SEO on the change.

I also agree with the plan to not enable the flag by default in this release, due to timing. We should explore turning it on for 7.0.200 and beyond, though - I think the existence of the PublishReferencesDocumentationFiles property and it being set to true by default is a strong enough signal to change this mid-release-cycle rather than waiting for the 8.0.x SDK series.

Copy link
Member

@dsplaisted dsplaisted left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 minor comments, looks good otherwise.


foreach (string fileExtension in relatedExtensions.Split(RelatedPropertySeparator))
{
if (fileExtension.ToLower() == extension)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should probably use invariant comparison

Suggested change
if (fileExtension.ToLower() == extension)
if (fileExtension.ToLowerInvariant() == extension)

}
else
{
_task.Log.LogWarning(Strings.AssetsFileNotFound, xmlFilePath);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't really the right error message here. Do we need to log a warning at all here?

@ocallesp ocallesp merged commit cd4dba4 into release/7.0.1xx Sep 12, 2022
@ocallesp ocallesp deleted the githubFix1458 branch September 12, 2022 19:30
rainersigwald pushed a commit to dotnet/msbuild that referenced this pull request Apr 6, 2023
…FilesFromPackages (#8621)

Related to a new feature (consuming pdbs/documents from packages), which was brought in in .NET 7.
PR from sdk: dotnet/sdk#27580

Document the `CopyDebugSymbolFilesFromPackages`  and `CopyDocumentationFilesFromPackages` properties.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

New project system doesn't copy PDBs from packages
5 participants