Repository navigation
[Microsoft.Android.Build.BaseTasks] Guard against null parent directory in GetNativeLibraryAbi - #13064
Merged
simonrozsival merged 8 commits intoOct 13, 2026
Conversation
austinaviv
requested review from
jonathanpeppers and
simonrozsival
as code owners
October 10, 2026 10:38
Contributor
Author
|
@dotnet-policy-service agree |
…ry in GetNativeLibraryAbi AndroidRidAbiHelper.GetNativeLibraryAbi threw a NullReferenceException when resolving native library items placed at root directories (such as C:\libfoo.so or /libfoo.so). When the immediate containing directory does not match a known ABI name, the helper checks the parent directory to detect RIDs like android-arm64/native. For rooted paths or filesystem roots, Directory.GetParent or dir.Parent can be null, causing dir.Parent.Name to throw a NullReferenceException. Add null checks for both dir and dir.Parent before inspecting their names, returning null if no ABI can be determined. Add unit test coverage for rooted paths and task items. Fixes: dotnet#13063
austinaviv
force-pushed
the
fix-13063-getnativelibraryabi-null-parent
branch
from
October 11, 2026 04:11
71203de to
8136d78
Compare
…kTrace throws (dotnet#13066) When constructing a Java.Lang.Throwable wrapper or activating via typemap with DoNotRegister, SetJavaStackTrace invokes printStackTrace in Java. If that call throws an exception, the constructor terminates without returning an instance to the caller. Because SetHandle did not catch exceptions around SetJavaStackTrace, the peer wrapper was never disposed, leaking the global reference created by Construct. Additionally, when DoNotRegister was not passed, the broken instance remained registered in ValueManager. Wrap SetJavaStackTrace in a try/catch block inside Throwable.SetHandle and call Dispose() on this before re-throwing. This releases the allocated GREF and unregisters the peer, fixing the stage 4 failures in RuntimeExceptionLookupFailureReleasesInput. Fixes dotnet#13066.
simonrozsival
requested changes
Oct 12, 2026
…and revert redundant Throwable try-catch
simonrozsival
approved these changes
Oct 12, 2026
…5->36 The macOS CI runner only has platforms;android-36 installed. compileSdk 35 caused Gradle to fail with: Failed to find Platform SDK with path: platforms;android-35 Fixes the APKs 2 package test failure in PR dotnet#13064.
simonrozsival
approved these changes
Oct 13, 2026
Member
|
/backport to release/11.0.1xx |
Contributor
|
Started backporting to |
jonathanpeppers
pushed a commit
that referenced
this pull request
Oct 13, 2026
…ry in GetNativeLibraryAbi (#13064) (#13099) Context: #13063 Guard against null parent directory in `AndroidRidAbiHelper.GetNativeLibraryAbi` (fixes #13063): When resolving the ABI for native libraries located directly at filesystem or drive roots (for instance `C:\libfoo.so` or `/libfoo.so`), `Directory.GetParent` or `dir.Parent` can be null, causing `dir.Parent.Name` to throw a `NullReferenceException`. Added `#nullable enable`, null checks on `dir` and pattern matching on `dir.Parent` before inspecting their names, returning null if no matching ABI can be determined. Added unit tests covering rooted paths, root directories, and `ITaskItem` instances. Fixes #13063. Co-authored-by: Austin <abhikr6714@gmail.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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Context: #13063
Guard against null parent directory in
AndroidRidAbiHelper.GetNativeLibraryAbi(fixes #13063):When resolving the ABI for native libraries located directly at filesystem or drive roots (for instance
C:\libfoo.soor/libfoo.so),Directory.GetParentordir.Parentcan be null, causingdir.Parent.Nameto throw aNullReferenceException. Added#nullable enable, null checks ondirand pattern matching ondir.Parentbefore inspecting their names, returning null if no matching ABI can be determined. Added unit tests covering rooted paths, root directories, andITaskIteminstances.Fixes #13063.