Skip to content

[Tests] Re-enable unhandled exception event test on NativeAOT - #13681

Merged
jonathanpeppers merged 2 commits into
mainfrom
simonrozsival-unhandled-exception-test
Nov 20, 2026
Merged

jonathanpeppers merged 2 commits into
mainfrom
simonrozsival-unhandled-exception-test

Conversation

@simonrozsival

Copy link
Copy Markdown
Member

Context: #9784

NativeAOT raises AppDomain.CurrentDomain.UnhandledException for fatal managed exceptions, but its case in SubscribeToAppDomainUnhandledException is still skipped. Remove the skip and expect the null sender observed on NativeAOT. Select the test target device so installation and launch use the same emulator as logcat when multiple devices are attached.

Validation

  • make prepare CONFIGURATION=Debug — passed.
  • git submodule update --init external/android-api-docs — initialized the missing documentation input; then make leeroy CONFIGURATION=Debug MSBUILD_ARGS='-m:4' passed.
  • ./dotnet-local.sh build tests/MSBuildDeviceIntegration/MSBuildDeviceIntegration.csproj -c Debug -m:4 -v:minimal — passed, 0 warnings and 0 errors.
  • ADB_TARGET='-s emulator-5556' TEST_ANDROID_SDK_PATH=/Users/simon/android-toolchain/sdk TEST_ANDROID_NDK_PATH=/Users/simon/android-toolchain/ndk TEST_ANDROID_JDK_PATH=/Users/simon/android-toolchain/jdk-25 ./dotnet-local.sh test bin/TestDebug/MSBuildDeviceIntegration/net11.0/MSBuildDeviceIntegration.dll --filter 'Name~SubscribeToAppDomainUnhandledException' --logger 'trx;LogFileName=unhandled-exception-targeted.trx' --results-directory /Users/simon/.copilot/session-state/fc846f78-0f7c-4683-81de-7ee126758efb/files/test-results — passed, 2 tests (CoreCLR and NativeAOT), 0 failed, 0 skipped on an API 35 arm64 emulator.

NativeAOT raises AppDomain.CurrentDomain.UnhandledException for fatal\nmanaged exceptions, but the device test remains skipped and its expected\nsender switch does not include NativeAOT. Remove the skip and expect its\nnull sender. Select the test target device so installation and launch use\nthe same emulator as logcat in multi-device runs.

Context: #9784

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings November 20, 2026 16:07

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues remain for the update restoring NativeAOT unhandled-exception test coverage.

No open issues 🎉

What changed in this PR

Restores NativeAOT coverage for AppDomain.CurrentDomain.UnhandledException in the device integration tests, addressing a remaining item in #9784.

Changes:

  • Removes the NativeAOT test skip.
  • Expects a null event sender for both CoreCLR and NativeAOT.
  • Selects the default target device so installation, launch, and logcat use the same device.
File Description
tests/​MSBuildDeviceIntegration/​Tests/​InstallAndRunTests.cs Re-enables the NativeAOT exception-event test, updates the sender expectation, and aligns device targeting.

Review effort: Balanced

The expected sender is null for both supported runtimes, so interpolating a runtime switch adds no value. Match the logcat output directly.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@jonathanpeppers

Copy link
Copy Markdown
Member

CI triage for build 1692357: the build is red (31 jobs passed, 5 failed), but the failures do not appear related to this PR.

The re-enabled SubscribeToAppDomainUnhandledException test passed for both CoreCLR and NativeAOT. All six failed test results are from InstallAndroidDependenciesTest on Windows, Linux, and macOS. The Android CLI could not install platform-tools@37.0.1; the same failure occurred on the PR's base commit.

This matches #13644. PR #13666, which updates the package pin to 37.0.3, is still open.

@jonathanpeppers
jonathanpeppers merged commit 4bfcc92 into main Nov 20, 2026
32 of 38 checks passed
@jonathanpeppers
jonathanpeppers deleted the simonrozsival-unhandled-exception-test branch November 20, 2026 20:54
simonrozsival added a commit that referenced this pull request Nov 21, 2026
The rebase onto cc7cbf6 kept the pre-rebase MSTest conversions of
files that main had changed since aa688ac, which reverted those
changes and broke the build. For each affected file, convert main's
old and new NUnit versions with the same converter and merge the
difference into the MSTest file:

  * cca255c (#13592): drop the Android lint tests and assertions.
  * 5b32fb1 (#13602): add RelativeDirectoriesUseProjectDirectory and
    the -mt CollectNonEmptyDirectories coverage.
  * 78ef747 (#13655): add OpenGenericProxiesKeepTheReflectionActivationConstructor.
  * 18b8940 (#13585): add the generator nullability/obsolete tests.
  * dcbd008 (#13580): add the AmbiguousFunctionMetadata_* tests.
  * 667e27a (#13621): add the sdkmanager package ID tests.
  * 5ecb8f7 (#13614): drop RunWithLoggingEnablesManagedTimingLogger.
  * 8287b17 (#13680), 4bfcc92 (#13681): restore the re-enabled
    tests and removed TODOs.
  * 5d81a0f (#13666): expect platform-tools 37.0.3.
  * 8442c75 (#13601): assert the pulled device TRX is deleted.

Also drop the EnableNUnitRunner/OutputType lines that 857f463
(#13563) added to Xamarin.Android.Build.Tests and MSBuildDeviceIntegration;
MSTestReferences.projitems sets both.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants