dotnet / dotnet/macios

Extensions Require Static Registrar

Open
#24,869 2 comments 0 reactions 1 assignee Claimed by @rolfbjarne View on GitHub
app-extensions bug
Dominant language
C#
Stars
2.9k
Forks
576
Avg merge
2d 12h
Merged PRs (30d)
123

Description

### Apple platform

iOS

### Framework version

net10.0-*

### Affected platform version

26.2.10191/10.0.100

### Description

I just spent the last few days debugging a persistent crash in my QuickLook thumbnails provider for my app.

The fix ended up being to force the static registrar with this project setting:

```xml
static
```

This is in addition to the normal extension properties:

```xml
true
false
```

May I suggest forcing Registrar=static when compiling extensions?

### Steps to Reproduce

1. Create a new iOS app
2. Create a new iOS extension
3. Reference the extension from the app

### Did you find any workaround?

Yes, the workaround seems to be to force the static registrar.

This is the result of GPT-5.3-Codex:

> I found the crash mechanism: that callback does an indirect [blr x2](), and [x2]() comes from a runtime function table entry that appears to be zero at runtime. I’ll inspect generated [main.arm64.mm]()/registrar glue to see why that table entry is uninitialized in extension startup.
>
> I now have concrete evidence: the crash path is an indirect branch ([blr x2]()) in the generated constructor callback, and that function table is from the managed static registrar pipeline. I’m going to force CircuitThumbs to use the native static registrar (Registrar=static) and verify that generated startup code flips off managed-static mode.
>
> You're right to demand proof. I dug into the generated binary path and found a concrete failure mechanism, then changed one build setting to remove that mechanism.
>
> What I verified (not guessing)
>
> In your crashing pattern, [-[CircuitThumbnailProvider init]]() called a registrar callback that used an indirect branch through a function table.
> In the managed-static registrar build, that callback path had:
direct call from init to callback
then [blr x2]() from callback ([x2]() loaded from registrar/runtime table)
if that slot is zero, you get exactly your EXC_BAD_ACCESS (addr=0x0) at init time.
This is visible in the built extension disassembly at [CircuitThumbs]().
>
> Change I made
>
> Set the extension to use native static registrar instead of managed-static:
[CircuitThumbs.csproj](): added `static`.

### Build logs

_No response_

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.