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

When possible, use Reference6 to read ProjectReference metadata such as ReferenceOutputAssembly #4327

Merged
merged 9 commits into from
Nov 12, 2021

Conversation

nkolev92
Copy link
Member

@nkolev92 nkolev92 commented Oct 29, 2021

Bug

Fixes: NuGet/Home#11163

Regression? Last working version:

Description

This is an attempt to the fix the UI delay caused by the double walk of the references..

I setup a test repo with the following relevant projects.

  1. CPlusPlus.vcxproj - CpsProjectSystemReferencesReader
  2. LegacyMSbuildProj.msbuildproj VSCoreProjectSystemReferencesReader
  3. LegacyPackagesConfig.csproj VSCoreProjectSystemReferencesReader
  4. ServiceFabric.sfproj VSCoreProjectSystemReferencesReader
  5. Stateless.csproj VsManagedLanguagesProjectSystemServices

The project references are as follows:

LegacyPackagesConfig.csproj
=> CPlusPlus.vcxproj
=> LegacyMSbuildProj.msbuildproj
=> Stateless.csproj
ServiceFabric.sfproj
=> Stateless.csproj
LegacyMSbuildProj.msbuildproj
=> Stateless.csproj

When walking each of the 3 above projects for ProjectReference, the following happens:

  • All the LegacyPackagesConfig project references can be cast to Reference6.
  • None of the ServiceFabric project references can be cast to Reference6, but can be cast to Reference3.
  • None of the LegacyMSbuildProj project references can be cast to Reference6, but can be cast to Reference3.

The proposal is the following:

Currently the behavior is:

  • walk the tree for projects that should be excluded.
  • walk the tree for all projects and skip the ones that should be excluded.

The first part is the expensive part.

The proposal is:

  • Walk the tree for all projects and if the projects can be cast to Reference6, then just use the metadata from there, otherwise use Reference3 and keep track of the fact that we couldn't get the metadata.
  • If any of the above projects couldn't be cast to Reference6, walk the tree for the excluded projects the expensive way to avoid any functional regressions (which are frankly, pretty unlikely, but we can't break the experience.)

This should fix the UI delay for most project types.

@lifengl @davkean
Based on the above findings, we'd need CPS to implement Reference6 - https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1431168

PR Checklist

  • PR has a meaningful title

  • PR has a linked issue.

  • Described changes

  • Tests

    • Automated tests added
    • OR
    • Test exception - Existing behavior.
    • OR
    • N/A
  • Documentation

    • Documentation PR or issue filled
    • OR
    • N/A

@nkolev92 nkolev92 changed the title Dev nkolev92 UI delay project ref legacy When possible, use Reference6 to read ProjectReference metadata such as ReferenceOutputAssembly Oct 29, 2021
@nkolev92 nkolev92 force-pushed the dev-nkolev92-uiDelay-projectRefLegacy branch from 2481252 to f8b28e8 Compare November 5, 2021 22:24
@nkolev92 nkolev92 marked this pull request as ready for review November 5, 2021 22:36
@nkolev92 nkolev92 requested a review from a team as a code owner November 5, 2021 22:36
@nkolev92 nkolev92 force-pushed the dev-nkolev92-uiDelay-projectRefLegacy branch from bb73c43 to fd78b58 Compare November 9, 2021 00:28
@nkolev92
Copy link
Member Author

@NuGet/nuget-client

Can I please get a review here?


static string GetReferenceMetadataValue(Array metadataElements, Array metadataValues)
{
if (metadataElements == null || metadataValues == null || metadataValues.Length == 0)
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we add metadataElements.Length == 0 condition also?

Another question that I have is, metadataElements argument value is not used except for null or empty checks. Do we need this parameter?

Copy link
Member Author

Choose a reason for hiding this comment

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

I think we can just remove metadataElements.

@nkolev92 nkolev92 force-pushed the dev-nkolev92-uiDelay-projectRefLegacy branch from fd78b58 to 8a108ba Compare November 11, 2021 02:22
@nkolev92 nkolev92 requested a review from erdembayar November 11, 2021 02:26
@nkolev92 nkolev92 merged commit 966f607 into dev Nov 12, 2021
@nkolev92 nkolev92 deleted the dev-nkolev92-uiDelay-projectRefLegacy branch November 12, 2021 19:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
6 participants