Skip to content

Unix drive enumeration imports not expanded? #8373

@JanKrivanek

Description

@JanKrivanek

Background

1) Drive enumeration imports doesn't seem to be expanded

This is only failing leftover case from #7330

Investigation needed - it seems that the \**\*.targets path in project import is not expanded

Testcase:
https://github.com/dotnet/msbuild/blob/main/src/Build.OM.UnitTests/Definition/ProjectItem_Tests.cs#L908-L911

Failing on unix:

  Message: 
Microsoft.Build.Exceptions.InvalidProjectFileException : The imported project "/**/*.targets" was not found. Confirm that the expression in the Import declaration "/**/*.targets" is correct, and that the file exists on disk.  /tmp/1smloziu.eao/MSBuildTemproot/Temporary6dfc065a89bb48c6b0fbe28f55e56cfb/build.proj

  Stack Trace: 
ProjectErrorUtilities.ThrowInvalidProject(String errorSubCategoryResourceName, IElementLocation elementLocation, String resourceName, Object[] args) line 405
ProjectErrorUtilities.ThrowInvalidProject[T1,T2](IElementLocation elementLocation, String resourceName, T1 arg0, T2 arg1) line 98
Evaluator`4.ExpandAndLoadImportsFromUnescapedImportExpression(String directoryOfImportingFile, ProjectImportElement importElement, String unescapedExpression, Boolean throwOnFileNotExistsError, List`1& imports) line 2298
Evaluator`4.ExpandAndLoadImportsFromUnescapedImportExpressionConditioned(String directoryOfImportingFile, ProjectImportElement importElement, List`1& projects, SdkResult& sdkResult) line 1926
Evaluator`4.ExpandAndLoadImports(String directoryOfImportingFile, ProjectImportElement importElement, SdkResult& sdkResult) line 1576
Evaluator`4.EvaluateImportElement(String directoryOfImportingFile, ProjectImportElement importElement) line 1459
Evaluator`4.PerformDepthFirstPass(ProjectRootElement currentProjectOrImport) line 910
Evaluator`4.Evaluate() line 644
Evaluator`4.Evaluate(IEvaluatorData`4 data, Project project, ProjectRootElement root, ProjectLoadSettings loadSettings, Int32 maxNodeCount, PropertyDictionary`1 environmentProperties, ILoggingService loggingService, IItemFactory`2 itemFactory, IToolsetProvider toolsetProvider, ProjectRootElementCacheBase projectRootElementCache, BuildEventContext buildEventContext, ISdkResolverService sdkResolverService, Int32 submissionId, EvaluationContext evaluationContext, Boolean interactive) line 337
ProjectInstance.Initialize(ProjectRootElement xml, IDictionary`2 globalProperties, String explicitToolsVersion, String explicitSubToolsetVersion, Int32 visualStudioVersionFromSolution, BuildParameters buildParameters, ILoggingService loggingService, BuildEventContext buildEventContext, ISdkResolverService sdkResolverService, Int32 submissionId, Nullable`1 projectLoadSettings, EvaluationContext evaluationContext) line 2785
ProjectInstance.ctor(String projectFile, IDictionary`2 globalProperties, String toolsVersion, String subToolsetVersion, ProjectCollection projectCollection, Nullable`1 projectLoadSettings, EvaluationContext evaluationContext) line 278
ProjectInstance.FromFile(String file, ProjectOptions options) line 739
ProjectItem_Tests.CreateProjectInstanceFromFileWithDriveEnumeratingWildcard(TestEnvironment env, String testProjectFile, Boolean throwException) line 992
ProjectItem_Tests.CleanContentsAndCreateProjectInstanceFromFileWithDriveEnumeratingWildcard(String content, Boolean throwException) line 967
ProjectItem_Tests.LogWarningUponProjectInstanceCreationFromDriveEnumeratingContent(String content, String placeHolder, String excludePlaceHolder) line 955
RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
MethodInvoker.Invoke(Object obj, IntPtr* args, BindingFlags invokeAttr)

2) Long run of the ProjectGetterResultsInUnixDriveEnumerationWarning and LogWarningUponProjectInstanceCreationFromDriveEnumeratingContent tests on Unix platforms

This is caused by the fact that the actual whole root is attempted to be enumerated.
We should try to find similar mapping trick as for the Windows runs (https://unix.stackexchange.com/questions/206493/mount-directory-onto-root ?), or make the production code to detect and bail out quicker.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions