runtime: Android API 23, Runtime Crash in .NET 9
Description
We have a nightly test pipeline that runs our test suite on older Android emulators.
The API 23 emulator crashes at runtime with:
08-06 03:33:12.480 2745 2745 F mono-rt : [ERROR] FATAL UNHANDLED EXCEPTION: Nested exception detected.
08-06 03:33:12.480 2745 2745 F mono-rt : Original Exception: at System.Threading.Thread.get_CurrentThread () [0x00009] in <d7679677bb2b4cc291070c60be6bf246>:0
08-06 03:33:12.480 2745 2745 F mono-rt : at System.Threading.Monitor.Exit (object) [0x0000e] in <d7679677bb2b4cc291070c60be6bf246>:0
08-06 03:33:12.480 2745 2745 F mono-rt : at System.AppContext.GetData (string) [0x00037] in <d7679677bb2b4cc291070c60be6bf246>:0
08-06 03:33:12.480 2745 2745 F mono-rt : at System.AppContext.TryGetSwitch (string,bool&) [0x00040] in <d7679677bb2b4cc291070c60be6bf246>:0
08-06 03:33:12.480 2745 2745 F mono-rt : at System.AppContextConfigHelper.GetBooleanConfig (string,bool) [0x00000] in <d7679677bb2b4cc291070c60be6bf246>:0
08-06 03:33:12.480 2745 2745 F mono-rt : at System.LocalAppContextSwitches.GetDefaultShowILOffsetSetting () [0x00014] in <d7679677bb2b4cc291070c60be6bf246>:0
08-06 03:33:12.480 2745 2745 F mono-rt : at System.Diagnostics.StackTrace.ToString (System.Diagnostics.StackTrace/TraceFormat,System.Text.StringBuilder) [0x002ee] in <d7679677bb2b4cc291070c60be6bf246>:0
08-06 03:33:12.480 2745 2745 F mono-rt : at System.Diagnostics.StackTrace.ToString (System.Diagnostics.StackTrace/TraceFormat) [0x0000b] in <d7679677bb2b4cc291070c60be6bf246>:0
08-06 03:33:12.480 2745 2745 F mono-rt : at System.Exception.GetStackTrace () [0x00007] in <d7679677bb2b4cc291070c60be6bf246>:0
08-06 03:33:12.480 2745 2745 F mono-rt : at System.Exception.get_StackTrace () [0x00023] in <d7679677bb2b4cc291070c60be6bf246>:0
08-06 03:33:12.480 2745 2745 F mono-rt : at System.Exception.ToString () [0x0001f] in <d7679677bb2b4cc291070c60be6bf246>:0
08-06 03:33:12.480 2745 2745 F mono-rt : at System.Exception.ToString () [0x0000c] in <d7679677bb2b4cc291070c60be6bf246>:0
08-06 03:33:12.480 2745 2745 F mono-rt : at System.Exception.ToString () [0x0000c] in <d7679677bb2b4cc291070c60be6bf246>:0
08-06 03:33:12.480 2745 2745 F mono-rt :
08-06 03:33:12.480 2745 2745 F mono-rt : Nested exception:at System.Threading.Thread.get_CurrentThread () [0x00009] in <d7679677bb2b4cc291070c60be6bf246>:0
08-06 03:33:12.480 2745 2745 F mono-rt : at System.Threading.Monitor.Exit (object) [0x0000e] in <d7679677bb2b4cc291070c60be6bf246>:0
08-06 03:33:12.480 2745 2745 F mono-rt : at System.AppContext.GetData (string) [0x00037] in <d7679677bb2b4cc291070c60be6bf246>:0
08-06 03:33:12.480 2745 2745 F mono-rt : at System.AppContext.TryGetSwitch (string,bool&) [0x00040] in <d7679677bb2b4cc291070c60be6bf246>:0
08-06 03:33:12.480 2745 2745 F mono-rt : at System.AppContextConfigHelper.GetBooleanConfig (string,bool) [0x00000] in <d7679677bb2b4cc291070c60be6bf246>:0
08-06 03:33:12.480 2745 2745 F mono-rt : at System.LocalAppContextSwitches.GetDefaultShowILOffsetSetting () [0x00014] in <d7679677bb2b4cc291070c60be6bf246>:0
08-06 03:33:12.480 2745 2745 F mono-rt : at System.Diagnostics.StackTrace.ToString (System.Diagnostics.StackTrace/TraceFormat,System.Text.StringBuilder) [0x002ee] in <d7679677bb2b4cc291070c60be6bf246>:0
08-06 03:33:12.480 2745 2745 F mono-rt : at System.Diagnostics.StackTrace.ToString (System.Diagnostics.StackTrace/TraceFormat) [0x0000b] in <d7679677bb2b4cc291070c60be6bf246>:0
08-06 03:33:12.480 2745 2745 F mono-rt : at System.Exception.GetStackTrace () [0x00007] in <d7679677bb2b4cc291070c60be6bf246>:0
08-06 03:33:12.480 2745 2745 F mono-rt : at System.Exception.get_StackTrace () [0x00023] in <d7679677bb2b4cc291070c60be6bf246>:0
08-06 03:33:12.480 2745 2745 F mono-rt : at System.Exception.ToString () [0x0001f] in <d7679677bb2b4cc291070c60be6bf246>:0
08-06 03:33:12.480 2745 2745 F mono-rt : at System.Exception.ToString () [0x0000c] in <d7679677bb2b4cc291070c60be6bf246>:0
08-06 03:33:12.480 2745 2745 F mono-rt : at System.Exception.ToString () [0x0000c] in <d7679677bb2b4cc291070c60be6bf246>:0
This appears to be working fine on newer API levels.
Reproduction Steps
Run this test project on an API 23 emulator:
Expected behavior
Our test suite passes on API 23 emulators.
Actual behavior
Our test suite crashes on API 23 emulators.
Regression?
Yes, this is working in .NET 8.
Known Workarounds
n/a
Configuration
Noticed with:
- .NET SDK 9.0.100-rc.1.24381.10
- Runtime 9.0.0-rc.1.24380.7
I think this was also happening in .NET 9 Preview 7 builds.
Other information
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 25 (25 by maintainers)
Commits related to this issue
- [tests] use x86_64 API 23 image on nightly pipeline Context: https://github.com/dotnet/runtime/issues/106025 Context: https://discord.com/channels/732297728826277939/732297837953679412/12967640556542... — committed to dotnet/android by jonathanpeppers 2 years ago
- [tests] use x86_64 API 23 image on nightly pipeline (#9414) Context: https://github.com/dotnet/runtime/issues/106025 Context: https://discord.com/channels/732297728826277939/732297837953679412/12967... — committed to dotnet/android by jonathanpeppers 2 years ago
After more investigation, we think this is some kind of bug in the x86, API 23 emulator image. API 21 is also working on our same pipeline, so this covers our minimum supported devices. API 23 was when Android first introduced some changes to loading native libraries, and its likely buggy.
We can close this, as we don’t think it’s a runtime issue.
There is some conversation on discord here for details:
Notably I’m not sure its “completely out of support” but rather that it isn’t supported if you’re wanting to target the “latest devices”.
There’s still reasons to target downlevel API levels to support some older devices, but there’s an overall balance required and I don’t think an official page for what versions are supported across devices still exist.