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] Add retry ability to RemoveDirFixed (#9409
) Fixes: #9133 Context: dotnet/android-tools@60fae19 Much to our chagrin, in .NET 6+ it is possible for Design-Time Builds (DTBs) to run concurrently with "normal" builds, as there is nothing within the [.NET Project System][0] or [Common Project System (CPS)][1] which would actively *prevent* such concurrency. Consequently, it is possible to encounter locked files and directories during the build process, and user may see errors such as: Error (active) XARDF7019 System.UnauthorizedAccessException: Access to the path 'GoogleGson.dll' is denied. at System.IO.Directory.DeleteHelper(String fullPath, String userPath, Boolean recursive, Boolean throwOnTopLevelDirectoryNotFound, WIN32_FIND_DATA& data) at System.IO.Directory.Delete(String fullPath, String userPath, Boolean recursive, Boolean checkHost) at Xamarin.Android.Tasks.RemoveDirFixed.RunTask() in /Users/runner/work/1/s/xamarin-android/src/Xamarin.Android.Build.Tasks/Tasks/RemoveDirFixed.cs:line 54 MauiApp2 (net9.0-android) C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\34.99.0-preview.6.340\tools\Xamarin.Android.Common.targets 2503 dotnet/android-tools@60fae192 introduced the concept of a "Retry" in the cases of `UnauthorizedAccessException`s or `IOException`s when the code is `ACCESS_DENIED` or `ERROR_SHARING_VIOLATION`. Builds upon that work to use the API's added to add retry semantics to the `<RemoveDirFixed/>` task. This also simplifies the Task somewhat as it had quite complex exception handling. [0]: https://github.com/dotnet/project-system [1]: https://github.com/microsoft/VSProjectSystem
- Loading branch information