Repository navigation
[Android] System.Tests.RandomTests.Next_IntInt_Next_IntInt_AllValuesAreWithinRange failing on android-arm #112946
Description
Build Information
Build: https://dev.azure.com/dnceng-public/public/_build/results?buildId=962825
Build error leg or test failing: System.Tests.RandomTests.Next_IntInt_Next_IntInt_AllValuesAreWithinRange
The test is consistently failing on android-arm (32-bit):
Last passing build: https://dev.azure.com/dnceng-public/public/_build/results?buildId=946422&view=results
First failing build: https://dev.azure.com/dnceng-public/public/_build/results?buildId=947194&view=results
Commit range: 02f99e5...91bbb32
Crash report:
02-25 14:01:16.594 30687 30711 I DOTNET : [FAIL] System.Tests.RandomTests.Next_IntInt_Next_IntInt_AllValuesAreWithinRange(derived: False, seeded: True, min: -1, max: 2147483647)
02-25 14:01:16.594 30687 30711 I DOTNET : Assert.InRange() Failure: Value not in range
02-25 14:01:16.594 30687 30711 I DOTNET : Range: (-1 - 2147483646)
02-25 14:01:16.594 30687 30711 I DOTNET : Actual: -2
Error Message
Fill the error message using step by step known issues guidance.
{
"ErrorMessage": [
"[FAIL] System.Tests.RandomTests.Next_IntInt_Next_IntInt_AllValuesAreWithinRange",
"Assert.InRange() Failure: Value not in range"
],
"BuildRetry": false,
"ExcludeConsoleLog": false
}Known issue validation
Build: 🔎 https://dev.azure.com/dnceng-public/public/_build/results?buildId=962825
Error message validated: [[FAIL] System.Tests.RandomTests.Next_IntInt_Next_IntInt_AllValuesAreWithinRange Assert.InRange() Failure: Value not in range]
Result validation: ✅ Known issue matched with the provided build.
Validation performed at: 2/27/2025 9:09:33 AM UTC
Report
Summary
| 24-Hour Hit Count | 7-Day Hit Count | 1-Month Count |
|---|---|---|
| 2 | 13 | 26 |
Report
Summary
| 24-Hour Hit Count | 7-Day Hit Count | 1-Month Count |
|---|---|---|
| 0 | 0 | 0 |
Activity
dotnet-policy-service commentedon Feb 26, 2025
Tagging subscribers to 'arch-android': @vitek-karas, @simonrozsival, @steveisok, @akoeplinger
See info in area-owners.md if you want to be subscribed.
dotnet-policy-service commentedon Feb 26, 2025
Tagging subscribers to this area: @dotnet/area-system-runtime
See info in area-owners.md if you want to be subscribed.
matouskozak commentedon Apr 11, 2025
Could it be caused by #112206 @tannergooding ?
tannergooding commentedon Apr 11, 2025
@matouskozak, I wouldn't expect so without it also triggering for Mono on other platforms -or- there being some pre-existing Mono Arm32 bug that the change just happened to expose.
All the PR does is handle the intrinsic and import it directly as the relevant IL opcode, there's not much room for it to have a mistake.
danmoseley commentedon Mar 22, 2026
Note
This comment was generated by GitHub Copilot.
Analysis
Summary
Random.Next(-1, int.MaxValue)returns -2 (below minimum) on Android ARM32 (Mono). Consistently failing since Feb 2025, 26+ CI hits.Root Cause
PR #112206 (merged Feb 10, 2025 — within the bisect range) is the culprit. Here's the chain:
CompatSeedImpl.Next(int, int)(used bynew Random(42)) callsdouble.ConvertToIntegerNative<long>(sample * range)whenrange > int.MaxValue(which is the case for min=-1, max=int.MaxValue → range=2147483648).Before Have mono handle ConvertToIntegerNative for Double and Single #112206,
ConvertToIntegerNativeon Mono was guarded by#if !MONOand fell through toTInteger.CreateSaturating(value)— a managed implementation that works correctly.After Have mono handle ConvertToIntegerNative for Double and Single #112206, the guard was removed and Mono now intrinsifies
ConvertToIntegerNative<long>asOP_FCONV_TO_I8(JIT) /MINT_CONV_I8_R8(interpreter).On ARM32 specifically,
OP_FCONV_TO_I8is emulated (seemini-arm.h:#define MONO_ARCH_EMULATE_FCONV_TO_I8 1). The emulation produces incorrect results — returning -1 for a positive double input, which then becomes-1 + (-1) = -2.This only hits ARM32 because ARM64/x64 have native 64-bit float→int instructions and don't use emulation.
Tanner's comment aligns with this analysis
He noted there would need to be "some pre-existing Mono Arm32 bug that the change just happened to expose." That's exactly what happened — the pre-existing bug is in Mono ARM32's
OP_FCONV_TO_I8emulation, and PR #112206 exposed it by routingConvertToIntegerNativethrough that code path for the first time.Possible fixes
OP_FCONV_TO_I8emulation on Mono ARM32 (proper fix)ConvertToIntegerNative<long>on ARM32 where emulation is needed, falling back to the managedCreateSaturatingpathvitek-karas commentedon Aug 7, 2026
This Known Build Error is being reviewed for closure because it appears inactive.
Available successfully analyzed
dotnet/runtimebuilds completed from September 14, 2023 through August 7, 2026 (UTC). No test failure in those builds was matched to this KBE.The last qualifying activity on this issue was a comment on March 22, 2026 at 04:31:12 UTC. No qualifying activity has occurred in the last three months.
This issue will be closed after seven complete days unless one of the following happens:
If any of these happens, the issue will remain open and will be removed from this closure cycle.
This comment was prepared with AI assistance.