Skip to content

MSB4018: The "CreateItem" task failed unexpectedly, MSB0001: Internal MSBuild Error: Missing resource 'GlobExpansionFailed' #12334

@chwarr

Description

@chwarr

Issue Description

We’re occasionally seeing failures in our Azure DevOps pipeline's invocations of MSBuild with an internal error saying "The "CreateItem" task failed unexpectedly." and an inner error saying "Missing resource 'GlobExpansionFailed'". We suspect this is happening when there is a problem with one of our globs or paths or something, but we also assume that "MSB0001: Internal MSBuild Error" isn't supposed to happen. 😊

This is happening with MSBuild version = "17.14.14+a129329f1".

##[error]5a855801-0d5d-4875-8a32-52fe6873fc68-Directory.Build.targets(81,5): Error MSB4018: The "CreateItem" task failed unexpectedly. 
Microsoft.Build.Framework.InternalErrorException: MSB0001: Internal MSBuild Error: Missing resource 'GlobExpansionFailed' 
at Microsoft.Build.Shared.ErrorUtilities.ThrowInternalError(String message, Object[] args) 
at Microsoft.Build.Shared.ErrorUtilities.VerifyThrow(Boolean condition, String unformattedMessage, Object arg0) 
at Microsoft.Build.Shared.AssemblyResources.GetString(String name) 
at Microsoft.Build.Shared.ResourceUtilities.FormatResourceStringIgnoreCodeAndKeyword(String resourceName, Object arg1, Object arg2) 
at Microsoft.Build.Shared.FileMatcher.GetFilesImplementation(String projectDirectoryUnescaped, String filespecUnescaped, List`1 excludeSpecsUnescaped) 
at Microsoft.Build.Shared.FileMatcher.GetFiles(String projectDirectoryUnescaped, String filespecUnescaped, List`1 excludeSpecsUnescaped) 
at Microsoft.Build.Tasks.CreateItem.TryExpandWildcards(ITaskItem[] expand, String attributeType) 
at Microsoft.Build.Tasks.CreateItem.Execute() 
at Microsoft.Build.BackEnd.TaskExecutionHost.Execute() 
at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext()

Steps to Reproduce

Here’s the MSBuild target that is referenced in the error message:

<Target Name="WarmUpWinmdGlobs" BeforeTargets="PrepareForBuild" Condition="'$(WindowsSDK_MetadataPathVersioned)'!=''">
  <!-- This triggers glob expansion in this node safely before the real target uses it -->
  <CreateItem Include="$(WindowsSDK_MetadataPathVersioned)\**\*.winmd" />
</Target>

I have a binlog and a pipeline link, but I cannot share them here on GitHub. I am a Microsoft employee and can share it with other employees. Contact me internally.

From the binlog, the string passed to CreateItem is "C:\Program Files (x86)\Windows Kits\10\References\10.0.26100.0***.winmd".

Expected Behavior

An error message telling me what went wrong during glob expansion.

Actual Behavior

Error MSB4018: The "CreateItem" task failed unexpectedly. 
Microsoft.Build.Framework.InternalErrorException: MSB0001: Internal MSBuild Error: Missing resource 'GlobExpansionFailed' 
at Microsoft.Build.Shared.ErrorUtilities.ThrowInternalError(String message, Object[] args) 
at Microsoft.Build.Shared.ErrorUtilities.VerifyThrow(Boolean condition, String unformattedMessage, Object arg0) 
at Microsoft.Build.Shared.AssemblyResources.GetString(String name) 
at Microsoft.Build.Shared.ResourceUtilities.FormatResourceStringIgnoreCodeAndKeyword(String resourceName, Object arg1, Object arg2) 
at Microsoft.Build.Shared.FileMatcher.GetFilesImplementation(String projectDirectoryUnescaped, String filespecUnescaped, List`1 excludeSpecsUnescaped) 
at Microsoft.Build.Shared.FileMatcher.GetFiles(String projectDirectoryUnescaped, String filespecUnescaped, List`1 excludeSpecsUnescaped) 
at Microsoft.Build.Tasks.CreateItem.TryExpandWildcards(ITaskItem[] expand, String attributeType) 
at Microsoft.Build.Tasks.CreateItem.Execute() 
at Microsoft.Build.BackEnd.TaskExecutionHost.Execute() 
at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext()

Analysis

FileMatcher.cs looks to be the only code that has references to the "GlobExpansionFailed" resource.

Versions & Configurations

MSBuild version = "17.14.14+a129329f1" invoked by Azure Pipeline's VSBuild@1 task.

AMD64 version of MSBuild used.

We are trying to build a slnx file.

We are building within a Windows container.

Metadata

Metadata

Assignees

Labels

Priority:1Work that is critical for the release, but we could probably ship without

Type

No fields configured for Bug.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions