fix: use thread-safe LogCodedWarning in Aapt2Compile.ProcessDirectory - #12292
Open
jonathanpeppers with Copilot wants to merge 2 commits into
Open
fix: use thread-safe LogCodedWarning in Aapt2Compile.ProcessDirectory#12292jonathanpeppers with Copilot wants to merge 2 commits into
jonathanpeppers with Copilot wants to merge 2 commits into
Conversation
Open
5 tasks
Co-authored-by: jonathanpeppers <[email protected]>
Copilot
AI
changed the title
[WIP] Fix Aapt2Compile to use thread-safe LogCodedWarning
fix: use thread-safe LogCodedWarning in Aapt2Compile.ProcessDirectory
Aug 2, 2026
jonathanpeppers
marked this pull request as ready for review
August 2, 2026 02:49
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the Aapt2Compile MSBuild task to use AsyncTask’s thread-safe warning logging helper when running work in parallel, avoiding the obsolete Log property which can hang Visual Studio when called from background threads.
Changes:
- Replaced
Log.LogCodedWarning(...)withLogCodedWarning(...)insideAapt2Compile.ProcessDirectory. - Preserved the existing warning code (
XA4323) and localized message (Properties.Resources.XA4323) to avoid behavior changes.
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.
Aapt2Compile.ProcessDirectoryruns on background threads (viaWhenAllWithLock) but logged a warning through the obsoleteLogproperty, which is not thread-safe and can hang Visual Studio.AsyncTaskexposes thread-safe logging helpers specifically for this reason.Change
Replace
Log.LogCodedWarningwith theAsyncTaskthread-safe helperLogCodedWarning— same signature, safe to call from background threads:No behavior change —
XA4323code and message are preserved.