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] fix NRE in XAJavaTypeScanner (#9087)
Context: https://devdiv.visualstudio.com/DevDiv/_build/results?buildId=9842772&view=logs&j=9a1c0345-5071-55ee-c0f3-a2911782c698&t=1e33272b-48f7-5132-3788-3179300312b4 We saw a `NullReferenceException` in `XAJavaTypeScanner` in the build linked above: Microsoft.Android.Sdk.Darwin/34.0.95/tools/Xamarin.Android.Common.targets(1536,3): error XAGJS7001: System.NullReferenceException: Object reference not set to an instance of an object. Microsoft.Android.Sdk.Darwin/34.0.95/tools/Xamarin.Android.Common.targets(1536,3): error XAGJS7001: at Xamarin.Android.Tasks.XAJavaTypeScanner.GetJavaTypes(ICollection`1 inputAssemblies, XAAssemblyResolver resolver) Microsoft.Android.Sdk.Darwin/34.0.95/tools/Xamarin.Android.Common.targets(1536,3): error XAGJS7001: at Xamarin.Android.Tasks.GenerateJavaStubs.Run(XAAssemblyResolver res, Boolean useMarshalMethods) Microsoft.Android.Sdk.Darwin/34.0.95/tools/Xamarin.Android.Common.targets(1536,3): error XAGJS7001: at Xamarin.Android.Tasks.GenerateJavaStubs.RunTask() Microsoft.Android.Sdk.Darwin/34.0.95/tools/Xamarin.Android.Common.targets(1536,3): error XAGJS7001: at Microsoft.Android.Build.Tasks.AndroidTask.Execute() in /Users/runner/work/1/s/xamarin-android/external/xamarin-android-tools/src/Microsoft.Android.Build.BaseTasks/AndroidTask.cs:line 25 I added `#nullable enable` to `XAJavaTypeScanner.cs`, and fixed the one warning that existed around `resolver.Load()`. Now, when `resolver.Load()` returns `null`, we'll log the Debug message: [{targetArch}] Unable to load assembly '…'
- Loading branch information