You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[net11] Class.GetHandle inlining turns nonexistent binding classes into hard link errors (Undefined _OBJC_CLASS_$_* in inlined-class-gethandle.o) on publish #26268
On .NET 11 preview 6 (net11.0-ios, iOS SDK pack 26.5.11720-net11-p6), dotnet publish -c Release fails at the native link with:
Undefined symbols for architecture arm64:
"_OBJC_CLASS_$_Session", referenced from:
in inlined-class-gethandle.o
ld: symbol(s) not found for architecture arm64
dotnet build (Debug AND Release) of the same project links fine — only the publish pipeline hits it.
Analysis
The referenced type comes from a third-party binding (Drastic.FFMpegKit 5.1.1) that declares a binding type named Session. In the native ffmpegkit.framework, Session is a protocol, not a class — the exported class symbols are AbstractSession, FFmpegSession, FFprobeSession, MediaInformationSession (verified with nm -gU):
On net10 this binding mistake was benign: Class.GetHandle("Session") was a lazy runtime lookup that either never executed or returned IntPtr.Zero. The new net11 Class.GetHandle inlining (per the generated inlined-class-gethandle.o) turns these lookups into direct _OBJC_CLASS_$_* symbol references, which makes any binding whose named native class doesn't actually exist a hard link failure — even when the type is never used at runtime.
Expected
Either the optimization falls back to runtime lookup (or emits a weak reference) for classes that can't be proven to exist, or this behavioral change is documented as breaking for existing (admittedly imperfect) binding packages — a large ecosystem of third-party bindings will hit this.
Repro
Reference a binding library containing [BaseType(typeof(NSObject))] interface Session {} where no ObjC class named Session exists in the linked native framework (protocol-only name).
dotnet publish -c Release -r ios-arm64 on net11.0-ios p6 → link error above. dotnet build succeeds.
Real-world package that triggers it: Drastic.FFMpegKit.full.ios 5.1.1.
Repro requires PublishAot=true (NativeAOT). The failing inlined-class-gethandle.o comes from the managed static registrar path.
dotnet publish -p:PublishAot=false — which on net11 is the CoreCLR runtime path (Mono is gone in net11 mobile) — links and produces a working IPA from the identical project. That's the practical workaround.
-p:MtouchExtraArgs=--optimize=-redirect-class-handles is accepted but does NOT avoid the error, so the class-handle inlining in the managed static registrar appears unconditional rather than gated on that optimization.
Sharpened summary: the NativeAOT managed static registrar emits hard _OBJC_CLASS_$_* references for binding types whose native class doesn't exist (protocol-only names), breaking publish for existing binding packages. net10 NativeAOT with the same project/publish settings links fine, so this is new in the net11 p6 registrar.
Activity
pshoey commentedon Jul 23, 2026
Narrowed it down further:
PublishAot=true(NativeAOT). The failinginlined-class-gethandle.ocomes from the managed static registrar path.dotnet publish -p:PublishAot=false— which on net11 is the CoreCLR runtime path (Mono is gone in net11 mobile) — links and produces a working IPA from the identical project. That's the practical workaround.-p:MtouchExtraArgs=--optimize=-redirect-class-handlesis accepted but does NOT avoid the error, so the class-handle inlining in the managed static registrar appears unconditional rather than gated on that optimization.Sharpened summary: the NativeAOT managed static registrar emits hard _OBJC_CLASS_$_* references for binding types whose native class doesn't exist (protocol-only names), breaking publish for existing binding packages. net10 NativeAOT with the same project/publish settings links fine, so this is new in the net11 p6 registrar.
[linker] Don't inline Class.GetHandle for classes with a [Protocol] a…
rolfbjarne commentedon Jul 28, 2026
Thanks for the issue! I can confirm the bug, and a fix is in progress.
I don't know yet if the fix will be in the next preview 7 release, or only the first RC release.
[msbuild] Don't turn missing Objective-C classes into hard link error…
[release/11.0.1xx-preview7] [msbuild] Don't turn missing Objective-C …
rolfbjarne commentedon Jul 30, 2026
The fix will be included in Preview 7.