dotnet / runtime

.NET is a cross-platform runtime for cloud, mobile, desktop, and IoT apps.
https://docs.microsoft.com/dotnet/core/
MIT License
14.67k stars 4.58k forks source link

[6.0] tvOS arm64 build graph failure: project file not loaded System.Composition.AttributedModel.csproj #84334

Open carlossanlop opened 1 year ago

carlossanlop commented 1 year ago

Found in the 6.0 branding PR: https://github.com/dotnet/runtime/pull/84315

{
   "ErrorMessage" : "The project file could not be loaded. Could not find a part of the path",
   "BuildRetry": false,
   "ErrorPattern": "",
   "ExcludeConsoleLog": true
}

Report

Summary

24-Hour Hit Count 7-Day Hit Count 1-Month Count
0 0 0

Known issue validation

Build: :mag_right: Result validation: :warning: Validation could not be done without an Azure DevOps build URL on the issue. Please add it to the "Build: :mag_right:" line.

ghost commented 1 year ago

Tagging subscribers to 'os-tvos': @steveisok, @akoeplinger See info in area-owners.md if you want to be subscribed.

Issue Details
Found in the 6.0 branding PR: https://github.com/dotnet/runtime/pull/84315 - Job: https://dev.azure.com/dnceng-public/public/_build/results?buildId=227550&view=logs&j=f4520fb1-1559-5885-1d9c-3cb3f6a85e23&t=490cc617-3ad9-501b-c255-b75083dbb944 - Queue: `Build tvOS arm64 Release AllSubsets_Mono` - Failing step: Build product - Callstack: ``` /Users/runner/work/1/s/.dotnet/sdk/6.0.115/NuGet.RestoreEx.targets(19,5): error : at Microsoft.Build.Graph.GraphBuilder.BuildGraph() [/Users/runner/work/1/s/Build.proj] /Users/runner/work/1/s/.dotnet/sdk/6.0.115/NuGet.RestoreEx.targets(19,5): error : at Microsoft.Build.Graph.ProjectGraph..ctor(IEnumerable`1 entryPoints, ProjectCollection projectCollection, ProjectInstanceFactoryFunc projectInstanceFactory, Int32 degreeOfParallelism, CancellationToken cancellationToken) [/Users/runner/work/1/s/Build.proj] /Users/runner/work/1/s/.dotnet/sdk/6.0.115/NuGet.RestoreEx.targets(19,5): error : at Microsoft.Build.Graph.ProjectGraph..ctor(IEnumerable`1 entryPoints, ProjectCollection projectCollection, ProjectInstanceFactoryFunc projectInstanceFactory) [/Users/runner/work/1/s/Build.proj] /Users/runner/work/1/s/.dotnet/sdk/6.0.115/NuGet.RestoreEx.targets(19,5): error : at NuGet.Build.Tasks.Console.MSBuildStaticGraphRestore.LoadProjects(IEnumerable`1 entryProjects) [/Users/runner/work/1/s/Build.proj] ##[error].dotnet/sdk/6.0.115/NuGet.RestoreEx.targets(19,5): error : (NETCORE_ENGINEERING_TELEMETRY=Restore) The project file could not be loaded. Could not find a part of the path '/Users/runner/work/1/s/src/libraries/System.Composition/src/System.Composition.AttributedModel/src/System.Composition.AttributedModel.csproj'. /Users/runner/work/1/s/src/libraries/System.Composition/src/System.Composition.AttributedModel/src/System.Composition.AttributedModel.csproj at Microsoft.Build.Shared.ProjectFileErrorUtilities.VerifyThrowInvalidProjectFile(Boolean condition, String errorSubCategoryResourceName, BuildEventFileInfo projectFile, Exception innerException, String resourceName, Object[] args) at Microsoft.Build.Shared.ProjectFileErrorUtilities.ThrowInvalidProjectFile(BuildEventFileInfo projectFile, Exception innerException, String resourceName, Object[] args) at Microsoft.Build.Construction.ProjectRootElement.LoadDocument(String fullPath, Boolean preserveFormatting, Boolean loadAsReadOnly) at Microsoft.Build.Construction.ProjectRootElement..ctor(String path, ProjectRootElementCacheBase projectRootElementCache, Boolean preserveFormatting) at Microsoft.Build.Construction.ProjectRootElement.CreateProjectFromPath(String projectFile, ProjectRootElementCacheBase projectRootElementCache, Boolean preserveFormatting) at Microsoft.Build.Evaluation.ProjectRootElementCache.Get(String projectFile, OpenProjectRootElement openProjectRootElement, Boolean isExplicitlyLoaded, Nullable`1 preserveFormatting) at Microsoft.Build.Construction.ProjectRootElement.OpenProjectOrSolution(String fullPath, IDictionary`2 globalProperties, String toolsVersion, ProjectRootElementCacheBase projectRootElementCache, Boolean isExplicitlyLoaded) at Microsoft.Build.Evaluation.Project.ProjectImpl..ctor(Project owner, String projectFile, IDictionary`2 globalProperties, String toolsVersion, String subToolsetVersion, ProjectLoadSettings loadSettings, EvaluationContext evaluationContext) at Microsoft.Build.Evaluation.Project..ctor(String projectFile, IDictionary`2 globalProperties, String toolsVersion, String subToolsetVersion, ProjectCollection projectCollection, ProjectLoadSettings loadSettings, EvaluationContext evaluationContext) at Microsoft.Build.Evaluation.Project.FromFile(String file, ProjectOptions options) at NuGet.Build.Tasks.Console.MSBuildStaticGraphRestore.<>c__DisplayClass38_1.b__0(String path, Dictionary`2 properties, ProjectCollection collection) at Microsoft.Build.Graph.GraphBuilder.ParseProject(ConfigurationMetadata configurationMetadata) at System.Lazy`1.ViaFactory(LazyThreadSafetyMode mode) at System.Lazy`1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor) at System.Lazy`1.CreateValue() at Microsoft.Build.Graph.ParallelWorkSet`2.ExecuteWorkItem() at Microsoft.Build.Graph.ParallelWorkSet`2.WaitForAllWorkAndComplete() ``` ```json { "ErrorMessage" : "The project file could not be loaded. Could not find a part of the path", "BuildRetry": false, "ErrorPattern": "", "ExcludeConsoleLog": true } ```
Author: carlossanlop
Assignees: -
Labels: `arch-arm64`, `area-Infrastructure-mono`, `os-tvos`, `Known Build Error`
Milestone: 6.0.x
ericstj commented 1 year ago

It seems to me that Static graph restore either having a hard time with the relative path, or has an invalid value for LibrariesProjectRoot.
https://github.com/search?q=%22System.Composition.AttributedModel%22++repo%3Adotnet%2Fruntime+extension%3Acsproj&type=Code&ref=advsearch&l=&l=

Given the specific failure It's probably the relative path. https://github.com/dotnet/runtime/blob/67354a2fb4308650eb1d7db3277c862b8464c895/src/libraries/System.Composition.AttributedModel/tests/System.Composition.AttributeModel.Tests.csproj#L19

@jeffkl does this issue look familiar? Seems like it might be race condition where static graph gets confused about relative directory.

jeffkl commented 1 year ago

@ericstj I've seen this happen over the years with the MSBuild static graph API. For some reason a property does not have a value and the path gets mangled. At this point in restore, NuGet is loading projects via MSBuild so we're pretty confident something is wrong with static graph API. I'll ask around to see if anyone has figured out why this happens.

Adding @dfederm who has seen this, were you able to figure out why it's happening?

ericstj commented 1 year ago

It's also possible that this has been fixed in later SDKs, @carlossanlop noticed in our 6.0 branch which is using 6.0.115 SDK.