build: fix intermittent Sentry.aar file lock when packing Android projects - #5593
Open
jamescrosswell wants to merge 2 commits into
Open
jamescrosswell wants to merge 2 commits into
jamescrosswell wants to merge 2 commits into
Conversation
…jects race on With --no-build, pack reaches _CreateAar through ResolveReferences after the native library inputs have been extracted, so it writes <Project>.aar mid-pack. Dependent Android projects packed in parallel hash that file in ResolveLibraryProjectImports and fail with XARLP7024 on Linux. Closes #5092 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #5593 +/- ##
==========================================
+ Coverage 74.76% 74.84% +0.08%
==========================================
Files 515 515
Lines 18963 18963
Branches 3694 3694
==========================================
+ Hits 14177 14193 +16
+ Misses 3908 3892 -16
Partials 878 878 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
ric-oliv
approved these changes
Sep 18, 2026
ric-oliv
left a comment
Member
There was a problem hiding this comment.
Looks good! Just left one comment, but not blocking.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.
The
.NET (linux-x64)job intermittently fails atCreate NuGet PackageswithXARLP7024 ... Sentry.aar because it is being used by another process(e.g. runs 33028776243, 33814442277, 34296591536, 35170680025 twice).Closes #5092
Root cause
The
.aarthat locks isn't produced by the build. It's written duringdotnet pack --no-build:_GetFrameworkAssemblyReferences, which depends onResolveReferences. On Android that pulls in_UpdateAndroidResources→_CreateAar._CreateAarruns early, before the bindings' native libraries (libsentry.soetc.) are extracted intoEmbeddedNativeLibrary. It is skipped with "no inputs", so noSentry.aarexists after the build._CreateAarruns, so it writessrc/Sentry/bin/Release/net10.0-android36.0/Sentry.aar(andSentry.Maui.aar) mid-pack.Sentry.Maui's pack, running in parallel, globs*.aarfrom its reference directories (_ResolveAars) and hashes them inResolveLibraryProjectImports. On Linux, .NET emulatesFileSharewithflock, so the writer's exclusive lock makes that read fail.Verified locally with binlogs: after a Release build no
Sentry.aar/Sentry.Maui.aarexists, anddotnet pack --no-buildcreates both.Fix
In
src/Directory.Build.targets, for Android TFMs underNoBuild, clear_CreateAarInputsjust before_CreateAar. It is then skipped exactly as in the build. No workflow change needed.Sentry.Bindings.Android,SentryandSentry.Mauinupkgs are identical with and without the change. The project.aaris created after pack has already collected content, so a fresh pack never included it.Sentry.Bindings.Android.aar(a genuine build output) is left untouched.Sentry.aar(a duplicate of the bindings' native libs) inSentry.nupkg.This hooks the Android SDK's private
_CreateAar/_CreateAarInputsnames. If a future SDK renames them, the target becomes a silent no-op rather than a build break.#skip-changelog
🤖 Generated with Claude Code