Repository navigation
Description
Description
On .NET 11 RC1 for iOS (CoreCLR), a Release build crashes with EXC_BAD_ACCESS (SIGSEGV) inside the GC a few seconds after launch. Reproduced on both the simulator (iossimulator-arm64) and a physical device (ios-arm64). Setting PublishReadyToRun=false avoids it.
The crash is in MethodDesc::GetSig, reached from TransitionFrame::PromoteCallerStack while the GC scans stack roots during mark_phase. The GC reads what it believes is a MethodDesc* out of a TransitionFrame and dereferences it.
The value it dereferences is not a pointer — it is executable code. The faulting address is 0xa9025bf5a90153f9; the value read from the frame is 0xa9025bf5a90153f3. Decoded as AArch64, those 8 bytes are two consecutive instructions:
a9025bf5 stp x21, x22, [sp, #32]
a90153f9 stp x25, x20, [sp, #16]
That is a function prologue. The stack walker did not read a corrupted MethodDesc — it misidentified the frame layout and read bytes out of the code stream.
The crashing thread's stack interleaves CoreCLR interpreter frames with ReadyToRun frames:
InterpExecMethod / ExecuteInterpretedMethod / InterpreterStubRetVoid <- interpreter
<app>.r2r <- ReadyToRun
CallJittedMethodRetVoid / InvokeCalliStub
The main thread shows ~19 levels of nested interpreter↔R2R recursion at the point of the crash.
Observed matrix
| Configuration | PublishReadyToRun |
r2r framework in bundle | Result |
|---|---|---|---|
| Debug, simulator | true (SDK default) |
yes | stable |
| Release, simulator | true (SDK default) |
yes | SIGSEGV ~3s after launch |
| Release, device | true (SDK default) |
yes | SIGSEGV ~7s after launch |
| Release, simulator | false |
no | stable (75s+) |
| Release, device | false |
no | stable (10 min) |
I have not isolated what differs between the stable Debug build and the crashing Release build — both ship an r2r framework and both have PublishReadyToRun=true. Toggling PublishReadyToRun in Release is the only change I found that reliably flips the outcome.
PublishReadyToRun is defaulted to true by the iOS SDK for all CoreCLR builds — it is not an opt-in and not Release-specific (Xamarin.Shared.Sdk.props:302):
<!-- ReadyToRun configuration for CoreCLR -->
<PropertyGroup Condition="'$(UseMonoRuntime)' == 'false' And '$(_PlatformName)' != 'macOS' And '$(_UseNativeAot)' != 'true'">
<PublishReadyToRun Condition="'$(PublishReadyToRun)' == ''">true</PublishReadyToRun>
<PublishReadyToRunComposite Condition="... ">true</PublishReadyToRunComposite>
<PublishReadyToRunContainerFormat Condition="... ">macho</PublishReadyToRunContainerFormat>Environment
| SDK | 11.0.100-rc.1.26425.128 |
| Workload set | 11.0.100-rc.1.26460.1 |
| iOS workload manifest | 26.5.12194-net11-rc.1/11.0.100-rc.1 |
| TFM | net11.0-ios |
| RIDs affected | iossimulator-arm64 and ios-arm64 |
| Host | macOS 26.6.2 (25G83), Mac mini M1 |
| Xcode | 26.6 (17F113) |
| Simulator | iPhone 17, iOS 26.4.1 |
| Device | iPad, iOS 26.6.1 |
App scale: ~295 managed assemblies (Avalonia + ReactiveUI + MAUI Essentials).
Relevant Release configuration:
<MtouchLink>SdkOnly</MtouchLink>
<!-- PublishReadyToRun is NOT set in the project; the iOS SDK defaults it to true -->Resolved: Registrar=trimmable-static, PublishReadyToRun=true, PublishReadyToRunComposite=true, PublishReadyToRunContainerFormat=macho, UseMonoRuntime=false, AOTCompiler= (empty).
The project also sets MtouchInterpreter=-all and EnableSGenConc=true, but the SDK reports both as having no effect under CoreCLR, so they should not be relevant:
warning : The property 'MtouchInterpreter' has no effect when not using the Mono runtime
(for instance when using CoreCLR).
warning : The property 'EnableSGenConc' has no effect when not using the Mono runtime ...
Faulting stack (thread 20, simulator)
libcoreclr MethodDesc::GetSig(unsigned char const**, unsigned int*) + 40
libcoreclr MethodDesc::GetSignature() + 40
libcoreclr TransitionFrame::PromoteCallerStack(void (*)(Object**, ScanContext*, unsigned int), ScanContext*) + 76
libcoreclr GcStackCrawlCallBack(CrawlFrame*, void*) + 508
libcoreclr Thread::MakeStackwalkerCallback(...) + 116
libcoreclr Thread::StackWalkFramesEx(...) + 404
libcoreclr Thread::StackWalkFrames(...) + 180
libcoreclr ScanStackRoots(Thread*, ...) + 256
libcoreclr GCToEEInterface::GcScanRoots(...) + 260
libcoreclr WKS::gc_heap::mark_phase(int) + 552
libcoreclr WKS::gc_heap::gc1() + 444
libcoreclr WKS::gc_heap::garbage_collect(int) + 1156
libcoreclr WKS::GCHeap::GarbageCollectGeneration(unsigned int, gc_reason) + 716
libcoreclr WKS::gc_heap::trigger_gc_for_alloc(...) + 176
libcoreclr WKS::gc_heap::try_allocate_more_space(...) + 692
libcoreclr WKS::GCHeap::Alloc(gc_alloc_context*, unsigned long, unsigned int) + 124
libcoreclr Alloc(ee_alloc_context*, unsigned long, GC_ALLOC_FLAGS) + 324
libcoreclr AllocateSzArray(MethodTable*, int, GC_ALLOC_FLAGS) + 656
libcoreclr RhpGcAlloc + 200
libcoreclr RhpNewVariableSizeObject + 48
<app>.r2r (allocation site in ReadyToRun code)
...
libcoreclr InvokeUnmanagedCalliWithTransition(...)
libcoreclr InterpExecMethod(...)
libcoreclr ExecuteInterpretedMethod + 480
Register state at the fault:
x0: 0xa9025bf5a90153f3 x22: 0xa9025bf5a90153f3
far: 0xa9025bf5a90153f9 esr: 0x92000004 (Data Abort) byte read Translation fault
pc: MethodDesc::GetSig + 40
Exception Subtype: KERN_INVALID_ADDRESS at 0xa9025bf5a90153f9
(possible pointer authentication failure)
On the device the app terminates identically (Got a SIGSEGV while executing native code / App terminated due to signal 11) about 7 seconds after launch. I did not pull the device crash report, so the symbolicated stack above is from the simulator.
Repro
- Build a reasonably large
net11.0-iosCoreCLR app in Release withMtouchLink=SdkOnly, leavingPublishReadyToRununset so the iOS SDK default (true) applies. - Launch on an arm64 simulator or a device.
- The app starts and renders normally, then dies with SIGSEGV on the first GC that walks one of these frames — ~3s on the simulator, ~7s on device, reproducible every time.
I was not able to reduce this to a minimal project; it reproduces consistently in the full app but I do not know which code path allocates at the critical moment.
Workaround
<PublishReadyToRun>false</PublishReadyToRun>Verified stable: 75s+ on the simulator and 10 minutes on a physical device, where the default configuration crashed within seconds every time.
The workaround is expensive. With R2R off and no Mono AOT in play (AOTCompiler= is empty), the device IPA ships no precompiled managed code at all — 295 managed assemblies plus libcoreclr.framework, no r2r framework. Since iOS prohibits JIT on device, the app then runs fully interpreted.
Notes
- After the fault, the signal handler ran
EEPolicy::LogManagedCallstackForSignalon thread 0, which itself faulted inTypeString::AppendMethodImpl— presumably on the same badMethodDesc. Thread 0's reported stack is therefore the logging path, not its original state.
Activity
dotnet-policy-service commentedon Oct 5, 2026
Tagging subscribers to this area: @JulieLeeMSFT, @BrzVlad, @janvorli
See info in area-owners.md if you want to be subscribed.
dotnet-policy-service commentedon Oct 5, 2026
Tagging subscribers to 'os-ios': @vitek-karas, @kotlarmilos, @steveisok, @akoeplinger
See info in area-owners.md if you want to be subscribed.
vitek-karas commentedon Oct 5, 2026
@BrzVlad could you please also take a look?
@gentledepp I tried to repro it on simulator, but no luck so far (I'm running slightly different versions of mac and XCode though).
Regardless I wanted to ask about these:
MTouchLink- I don't think it will have effect, but it's worth a trySo far we haven't seen this anywhere really - so any kind of repro would be very helpful.
gentledepp commentedon Oct 12, 2026
Thanks for looking into this. Results:
We can't share the source publicly, but we have a repro package ready (~94 MB zip):
How would you like us to send it privately (e.g. email, or a file share link)?
gentledepp commentedon Oct 12, 2026
Root cause narrowed down: sqlite-net per-row column setters
The crash is in sqlite-net's per-row column setters, and the pattern is specific enough to rebuild in a small app.
What crashes
When the app reads inspections from SQLite, the R2R-compiled sqlite-net loop calls a delegate for every column of every row:
That's the exact call site. The return address is
MoveNext +0x774, right after ablrwithx1 = obj,x2 = stmt,x3 = i. The interpreter runs the delegate's target, and the crash happens in the interpreter's next call.How sqlite-net builds those delegates
This is
FastColumnSetter, read from the IL of oursqlite-net-pcl 1.10.0-optiq03fork:GetFastSetter<T>at runtime viaMakeGenericMethodover our model type. Generic code that is only instantiated at runtime like this isn't precompiled, so it runs interpreted.The setter itself belongs to our model class and is R2R-compiled.
3. A closure
(o, stmt, i) => setProperty((T)o, getValue(stmt, i))calls three things:SQLite3.ColumnType, a P/Invoke, which matches theInvokeUnmanagedCalliWithTransitionframe in this issueFuncSo the chain is:
The crash is somewhere on that path, most likely when the interpreter invokes the reflection-created open-instance delegate. The CoreCLR frames have no symbols, so I can't tell which of those calls it is.
This also explains the earlier observations
InspectionSqliteStore.GetInspectionsAsync.I am going to create a minimal repro based on these findings!
gentledepp commentedon Oct 12, 2026
Minimal repro
We now have a minimal repro, attached:
R2RSqliteRepro-135203.zipIt's a plain
dotnet new iosapp plus the publicsqlite-net-pcl 1.11.285, with SDK defaults exceptTrimMode=partial.Got a SIGSEGV while executing native code-p:PublishReadyToRun=falseEnvironment: iPhone 17 simulator, iOS 26.5, Xcode 26.6.
lldb shows
EXC_BAD_ACCESSat0xa9025bf5a90153f5. This is the same bad pointer as in our app, and it is made of ARM64 instruction bytes.Where it crashes
We symbolicated the composite R2R image of our app with a
crossgen2 --map. The crash happens while R2R code inSQLiteCommand.ExecuteDeferredQuery<T>.MoveNextinvokes sqlite-net's per-row column setter delegates (fastColumnSetters[i]).These delegates are built at runtime through
MakeGenericMethodand wrap an open-instance delegate:Their targets run on the interpreter, which calls back into R2R code.
Other results
MtouchLink=None, verified untrimmed): our app still crashes.FilterReadyToRunAssemblies=true, or onlyPublishReadyToRunCompositeRoots=System.Private.CoreLib.dll: stable. This is why our Debug builds never crashed: the iOS SDK sets the filter for every configuration except Release.vitek-karas commentedon Oct 12, 2026
Thanks a lot for the simple repro - I can repro it locally.
We will look into this some more...
vitek-karas commentedon Oct 13, 2026
I think this should be fixed in #134699 - which unfortunately didn't make RC2, so will only be in daily builds and GA. I'm trying to validate it with this specific repro still...
vitek-karas commentedon Oct 13, 2026
I was able to validate this - without #134699 the failure reproes locally, with that change it doesn't repro anymore. This should be fixed in GA.
gentledepp commentedon Oct 13, 2026
AWESOME! Thank you so much!!