NuGet / Home

Repo for NuGet Client issues
Other
1.5k stars 253 forks source link

RestoreUseStaticGraphEvaluation causes NuGet.RestoreEx.targets to throw an ANE when non-KnownToBeMSBuild project types are encountered #10019

Closed aolszowka closed 4 years ago

aolszowka commented 4 years ago

Details about Problem

NuGet product used: msbuild.exe

VS version: Visual Studio Enterprise 2019 Version 16.7.1

OS version (i.e. win10 v1607 (14393.321)): win2019 v1809 (17763.1397)

Worked before? If so, with which NuGet version: Yes; without /p:RestoreUseStaticGraphEvaluation=true

Detailed repro steps so we can see the same problem

Internally we rely heavily on a third party integration to Visual Studio which has its own custom project format. When we attempt to use RestoreUseStaticGraphEvaluation (msbuild TIMS.sln /restore /m /p:Configuration=Release /p:RestoreUsingStaticGraphEvaluation=true) we encounter this error, which looks to be an ArgumentNullException:

Build started 9/10/2020 3:10:17 PM.
     1>Project "S:\tims-subgit\TIMS.sln" on node 1 (Restore target(s)).
     1>ValidateSolutionConfiguration:
         Building solution configuration "Release|Any CPU".
       Restore:
         Determining projects to restore...
         Evaluated 1586 project(s) in 27517ms (1586 builds, 0 failures).
     1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\IDE\CommonExtensions\Microsoft\NuGet\NuGet.RestoreEx.targets(10,5): error : Value cannot be null. [S:\tims-subgit\TIMS.sln]
C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\IDE\CommonExtensions\Microsoft\NuGet\NuGet.RestoreEx.targets(10,5): error : Parameter name: path2 [S:\tims-subgit\TIMS.sln]
     1>Done Building Project "S:\tims-subgit\TIMS.sln" (Restore target(s)) -- FAILED.

On a whim we guessed that NuGet's RestoreUseStaticGraphEvaluation relies upon similar logic that expects SolutionProjectType.KnownToBeMSBuildFormat to be set.

We tested this by using a version of MSBuild built from source which has the necessary modifications for SolutionProjectType.KnownToBeMSBuildFormat to return true for this custom project type.

After doing so we no longer encounter the above error, however we encounter a major performance hit when attempting to execute (an order of magnitude longer than without /p:RestoreUseStaticGraphEvaluation=true). We assume that this is because the custom project type is either missing something or does not behave as this programming expects. Is there some guidance that we can pass on to our tooling vendor to opt into this behavior?

Testing this on pure C# Solution files yield impressive gains, which is why we would like to pursue this further.

We have a good working relationship with the tooling vendor, and would be willing to open a dialog to get the necessary environment to debug this issue. Please feel free to contact us offline at aceo at cu.net

aolszowka commented 4 years ago

Ugh this is embarrassing this is a duplicate of my own issue :( #9280 I am closing this as a duplicate, but it does contain additional information. Sorry!