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

[Bug]: Hang and/or MSB0001 when building terminal repo with /graph #9375

Closed
johnterickson opened this issue Oct 31, 2023 · 1 comment · Fixed by #9384
Closed

[Bug]: Hang and/or MSB0001 when building terminal repo with /graph #9375

johnterickson opened this issue Oct 31, 2023 · 1 comment · Fixed by #9384

Comments

@johnterickson
Copy link

Issue Description

Microsoft.Build.Framework.InternalErrorException
  HResult=0x80131500
  Message=MSB0001: Internal MSBuild Error: nodes should include solution projects
  Source=Microsoft.Build
  StackTrace:
   at Microsoft.Build.Shared.ErrorUtilities.ThrowInternalError(String message, Exception innerException, Object[] args)

 	Microsoft.Build.dll!Microsoft.Build.Shared.ErrorUtilities.ThrowInternalError(string message, System.Exception innerException, object[] args)	Unknown
 	Microsoft.Build.dll!Microsoft.Build.Graph.GraphBuilder.AddEdgesFromSolution(System.Collections.Generic.IReadOnlyDictionary<Microsoft.Build.BackEnd.ConfigurationMetadata, Microsoft.Build.Graph.ParsedProject> allParsedProjects, System.Collections.Generic.IReadOnlyDictionary<string, System.Collections.Generic.IReadOnlyCollection<string>> solutionDependencies, Microsoft.Build.Graph.GraphBuilder.GraphEdges edges)	Unknown
 	Microsoft.Build.dll!Microsoft.Build.Graph.GraphBuilder.AddEdges(System.Collections.Generic.Dictionary<Microsoft.Build.BackEnd.ConfigurationMetadata, Microsoft.Build.Graph.ParsedProject> allParsedProjects)	Unknown
 	Microsoft.Build.dll!Microsoft.Build.Graph.GraphBuilder.BuildGraph()	Unknown
 	Microsoft.Build.dll!Microsoft.Build.Graph.ProjectGraph.ProjectGraph(System.Collections.Generic.IEnumerable<Microsoft.Build.Graph.ProjectGraphEntryPoint> entryPoints, Microsoft.Build.Evaluation.ProjectCollection projectCollection, Microsoft.Build.Graph.ProjectGraph.ProjectInstanceFactoryFunc projectInstanceFactory, int degreeOfParallelism, System.Threading.CancellationToken cancellationToken)	Unknown
 	Microsoft.Build.dll!Microsoft.Build.Execution.BuildManager.ExecuteGraphBuildScheduler(Microsoft.Build.Graph.GraphBuildSubmission submission)	Unknown
 	Microsoft.Build.dll!Microsoft.Build.Execution.BuildManager.ExecuteSubmission.AnonymousMethod__0()	Unknown

Steps to Reproduce

  1. Clone https://github.com/johnterickson/terminal/commit/1f7018c5071fcb5bc3d86870c21c8cfe65540a91
  2. tools\razzle.cmd
  3. bcz

Expected Behavior

Build 1) succeeds or 2) fails with useful info

Actual Behavior

MsBuild.exe hangs

Analysis

I hooked up a debugger to capture the above stack trace.

Versions & Configurations

using msbuild version '17.7.2.37605' from 'C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\amd64'

@johnterickson johnterickson added bug needs-triage Have yet to determine what bucket this goes in. labels Oct 31, 2023
@dfederm
Copy link
Contributor

dfederm commented Oct 31, 2023

The exception means that there is a sln-dependency which isn't in the graph. But the solution was just parsed to produce the graph, so that means a project in the sln didn't make it into the graph.

Upon digging deeper, it look like this happens for projects which aren't "well-known" project types. In GraphBuilder:

            IReadOnlyCollection<ProjectInSolution> GetBuildableProjects(SolutionFile solutionFile)
            {
                return solutionFile.ProjectsInOrder.Where(p => p.ProjectType == SolutionProjectType.KnownToBeMSBuildFormat && solutionFile.ProjectShouldBuild(p.RelativePath)).ToImmutableArray();
            }

In this case the project you're hitting (a wapproj) is not "well-known" so it isn't considered.

The code should instead follow what MSBuild does when actually building a sln, ie the logic in SolutionProjectGenerator. This logic has logic for WouldProjectBuild and CanBuildDirectly for considering a project in a sln.

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

Successfully merging a pull request may close this issue.

4 participants