Skip to content

fix: use thread-safe LogCodedWarning in Aapt2Compile.ProcessDirectory - #12292

Open
jonathanpeppers with Copilot wants to merge 2 commits into
mainfrom
copilot/fix-finder-thread-safe-logging
Open

fix: use thread-safe LogCodedWarning in Aapt2Compile.ProcessDirectory#12292
jonathanpeppers with Copilot wants to merge 2 commits into
mainfrom
copilot/fix-finder-thread-safe-logging

Conversation

Copilot AI commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Aapt2Compile.ProcessDirectory runs on background threads (via WhenAllWithLock) but logged a warning through the obsolete Log property, which is not thread-safe and can hang Visual Studio. AsyncTask exposes thread-safe logging helpers specifically for this reason.

Change

Replace Log.LogCodedWarning with the AsyncTask thread-safe helper LogCodedWarning — same signature, safe to call from background threads:

// Before
Log.LogCodedWarning ("XA4323", Properties.Resources.XA4323, fileOrDirectory);

// After
LogCodedWarning ("XA4323", Properties.Resources.XA4323, fileOrDirectory);

No behavior change — XA4323 code and message are preserved.

Copilot AI changed the title [WIP] Fix Aapt2Compile to use thread-safe LogCodedWarning fix: use thread-safe LogCodedWarning in Aapt2Compile.ProcessDirectory Aug 2, 2026
Copilot AI requested a review from jonathanpeppers August 2, 2026 02:46
@jonathanpeppers
jonathanpeppers marked this pull request as ready for review August 2, 2026 02:49
Copilot AI review requested due to automatic review settings August 2, 2026 02:49
@jonathanpeppers jonathanpeppers added the ready-to-review This PR is ready to review/merge, I think any CI failures are just flaky (ignorable). label Aug 2, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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(...) with LogCodedWarning(...) inside Aapt2Compile.ProcessDirectory.
  • Preserved the existing warning code (XA4323) and localized message (Properties.Resources.XA4323) to avoid behavior changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-to-review This PR is ready to review/merge, I think any CI failures are just flaky (ignorable).

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[fix-finder] Aapt2Compile: use thread-safe LogCodedWarning instead of obsolete Log property

3 participants