Migrate Create(CSharp|VisualBasic)ManifestResourceName to multithreaded execution#13638
Draft
jankratochvilcz wants to merge 1 commit intomainfrom
Draft
Migrate Create(CSharp|VisualBasic)ManifestResourceName to multithreaded execution#13638jankratochvilcz wants to merge 1 commit intomainfrom
jankratochvilcz wants to merge 1 commit intomainfrom
Conversation
…tResourceName to multithreaded execution Adds [MSBuildMultiThreadableTask] to both concrete classes and routes file I/O through TaskEnvironment.GetAbsolutePath in the shared CreateManifestResourceName base. Subscribes the base class to IMultiThreadableTask with a TaskEnvironment.Fallback default. Closes part of #13172. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Migrates the C# and VB ManifestResourceName tasks to support MSBuild's multithreaded execution model.
Changes
[MSBuildMultiThreadableTask]applied to both concrete subclasses (CreateCSharpManifestResourceNameandCreateVisualBasicManifestResourceName). The attribute hasInherited=false, so it must be on each concrete class.CreateManifestResourceNamebase implementsIMultiThreadableTaskwithTaskEnvironment = TaskEnvironment.Fallbackdefault, so both subclasses inherit the property.TaskEnvironment.GetAbsolutePath(...): the existence probe for the convention-basedDependentUponsource file (FileSystems.Default.FileExists), and theFileStreamopened to parse the dependent source file for class-name extraction.Compatibility audit
Ran the 6-deadly-sins playbook (see
.github/skills/multithreaded-task-migration/SKILL.md):ManifestResourceNamesandResourceFilesWithManifestResourceNamesare constructed fromresourceFileandmanifestName; neither is derived fromAbsolutePath. The originalfileName(resourceFile.ItemSpec) is what subclasses see inCreateManifestName, so the produced manifest string keeps its existing form.catchusesresourceFile.ItemSpec(original) forLogErrorWithCodeFromResources; absolutized paths are only used for theFileExistsandFileStreamcalls and never logged.??operators added.Path.GetDirectoryName(fileName)returning null still flows intoPath.Combine, preserving the original throw-and-catch semantics underExceptionHandling.IsIoRelatedException.GetAbsolutePathcalls live inside the sametryblock as the file ops; the catch only references the originalresourceFile.ItemSpecande.Message, so no absolutized value is needed in the catch.itemSpecToTaskitemkeys on the originalresourceFile.ItemSpec(unchanged), and the existing code never usedPath.GetFullPathfor keys/comparisons.Path.GetDirectoryName/Path.Combinethrow on bad inputs, with the resulting exception caught byExceptionHandling.IsIoRelatedException(which includesArgumentException).GetAbsolutePaththrowingArgumentExceptionfor null/empty is funneled through the same catch, soExecutereturnsfalseexactly as before.Validation
Microsoft.Build.Tasks.csprojbuilds clean (0 warnings, 0 errors).Part of #11834. Closes part of #13172.