[Xamarin.Android.Build.Tasks] fix potential AsyncTask.Log calls #4205
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.
Backport of: #4187
We have had a continuing concern of accidentally calling methods on
AsyncTask.Log
from a background thread. If it happens, this cancause a hang inside Visual Studio on Windows.
I finally had the idea of creating a build error if we inadvertently
do this:
This uncovered 26 build errors! Some were actually on the main
thread and completely OK, but several were not OK.
In most of the places, I could simply change
Log.LogDebugMessage()
to
LogDebugMessage()
.However a few of the more troublesome places:
ManifestDocument
required aTaskLoggingHelper
for its ctor.I moved this to only the methods that need it.
NdkUtils
andNdkUtilsOld
I usedAction<string>
andAction<string, string>
callbacks instead.The
<Aot/>
task had an emptyValidateAotConfiguration()
method I removed.
Going forward, it should be a lot harder for us to introduce a hang
by using
AsyncTask.Log
.