Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Xamarin.Android.Build.Tasks] random error in <Aapt2Link/>
Context: http://build.devdiv.io/2547670 Context: dotnet#2911 (comment) We have been occasionally hitting this on CI: Xamarin.Android.Aapt2.targets(146,3): Value cannot be null. Parameter name: path at System.IO.File.Delete(String path) at Xamarin.Android.Tasks.Aapt2Link.DoExecute() at System.Threading.Tasks.Task.InnerInvoke() at System.Threading.Tasks.Task.Execute() [E:\A\_work\1214\s\bin\TestRelease\temp\CompileBeforeUpgradingNuGet\UnnamedProject.csproj] What I think is happening: * We call `tempFiles.Add()` during a `Parallel.ForEach`. Bad... * Instead of an exception happening during `Add()`, a `null` is somehow added to the underlying array--which is corrupted. Instead I think we should add locking around all usage of this `tempFiles` member variable. I looked at `ConcurrentBag<T>`, but it seemed more appropriate to use a lock because of the `foreach` + `Clear()` calls.
- Loading branch information