Skip to content

[mono][android-arm64] System.Threading.Volatile.ReadBarrier() never returns (hangs; or StackOverflow/SIGSEGV in deeper call chains) #130265

Description

@uholeschak

Description

Details:

  • net10.0-android36.1, RID android-arm64 (arm64-v8a), Debug, Mono JIT/interpreter (no AOT).
  • The [Intrinsic] is not recognized on this target; the self-referential managed
    fallback executes:
    • simple/direct call -> tail-call-optimized into an infinite loop -> HANGS forever
    • deep call chain (e.g. Roslyn CSharpCompilation.Emit) -> stack grows ->
      StackOverflowException / native SIGSEGV (SEGV_ACCERR, fault addr 16 bytes
      below a 4 KB page boundary, e.g. 0x...ff0; observed on Thread-18).
  • Output target is irrelevant: MemoryStream vs temp FileStream makes no difference.

Real-world trigger / version boundary:
Microsoft.CodeAnalysis.CSharp 5.3.0 -> OK
Microsoft.CodeAnalysis.CSharp 5.6.0 -> crash (calls ReadBarrier() during Emit)

Ruled out (all reproduce unchanged):
concurrentBuild:false; 16 MB thread stack; CreateFromStream; DOTNET_EnableHWIntrinsic=0;
all ~80 reference assemblies validated intact via PEReader.

Reproduction Steps

Simply execute in net10.0-android36.1:
Minimal repro (no Roslyn, no stream):
System.Threading.Volatile.ReadBarrier(); // never returns
ReadBarrier() hangs and finally generates a stack overflow

Expected behavior

System.Threading.Volatile.ReadBarrier();
should not crash.

Actual behavior

ReadBarrier() hangs and finally generates a stack overflow

Regression?

The problem occurs in combination with Microsoft.CodeAnalysis.CSharp.Scripting 5.6.0, because only this version uses ReadBarrier().
With Microsoft.CodeAnalysis.CSharp.Scripting 5.3.0 there is no problem.

Known Workarounds

Use Microsoft.CodeAnalysis.CSharp.Scripting 5.3.0 to avoid calling ReadBarrier().
Do not use Microsoft.CodeAnalysis.CSharp.Scripting 5.6.0 in net10.0-android36.1

Configuration

.NET SDK: 10.0.301

Android workload:
Workloadversion: 10.0.301.1

Installierte Workload-ID Manifestversion Installationsquelle

android 36.1.69/10.0.100 SDK 10.0.300, VS 18.7.11925.98
ios 26.5.10284/10.0.100 SDK 10.0.300, VS 18.7.11925.98
maccatalyst 26.5.10284/10.0.100 SDK 10.0.300, VS 18.7.11925.98
maui-windows 10.0.20/10.0.100 SDK 10.0.300, VS 18.7.11925.98

Other information

No response

Activity

  1. added
    needs-area-labelAn area label is needed to ensure this gets routed to the appropriate area owners
    on Jul 6, 2026
  2. added and removed
    needs-area-labelAn area label is needed to ensure this gets routed to the appropriate area owners
    on Jul 7, 2026
  3. jkotas commented on Jul 7, 2026

    @jkotas
    Member

    Fixed by #124538

  4. dotnet-policy-service commented on Jul 7, 2026

    @dotnet-policy-service
    Contributor

    Tagging subscribers to this area: @vitek-karas, @BrzVlad, @kotlarmilos
    See info in area-owners.md if you want to be subscribed.

  5. uholeschak commented on Jul 7, 2026

    @uholeschak
    Author

    Will this be fixed also in NET10?
    Basically this is a severe bug that also prevents usage of Microsoft.CodeAnalysis.CSharp.Scripting 5.6.0 in net10.0-android

  6. BrzVlad commented on Jul 13, 2026

    @BrzVlad
    Member

    This will be included in the 10.0.11 release, so it will take about a month for the fix to be available.

  7. self-assigned this
    on Jul 15, 2026
  8. removed
    untriagedNew issue has not been triaged by the area owner
    on Jul 15, 2026
  9. added this to the 10.0.x milestone on Jul 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions