Skip to content

[CI] Flaky: MonoTouchFixtures.CategoryTest.NavigationControllerOverride — NSAsyncActionDispatcher marshalling race condition #25861

Description

@rolfbjarne

Flaky Test Report (automated)

Test: MonoTouchFixtures.CategoryTest.NavigationControllerOverride
Platform: iOS (simulator, Debug)
Category: Flaky
Period: June 29, 2026

Occurrence Summary

PR Build Configuration Bot Direct Link
#25856 14516627 monotouch-test/iOS - simulator/Debug AcesShared 20 Run tests (attempt 1)

Total: Failed in 1 build; rerun (attempt 2) was triggered, confirming suspected flakiness.

Error Details

ObjCRuntime.RuntimeException : Failed to lookup the required marshalling information.
Additional information:
    Selector: xamarinApplySelector
    Type: __MonoMac_NSAsyncActionDispatcher
  Code: 8034
  Error: True
  ----> ObjCRuntime.RuntimeException : Failed to get the 'this' instance in a method call to Foundation.NSAsyncActionDispatcher.Apply.
  Code: 8035
  Error: True
  ----> ObjCRuntime.RuntimeException : Failed to marshal the Objective-C object 0x128759080 (type: __MonoMac_NSAsyncActionDispatcher). Could not find an existing managed instance for this object, nor was it possible to create a new managed instance (because the type 'Foundation.NSAsyncActionDispatcher' does not have a constructor that takes one NativeHandle argument).
  Code: 8027
  Error: True

Stack trace:

at ObjCRuntime.Runtime.RethrowManagedException(IntPtr exception_gchandle)
at ObjCRuntime.Runtime.rethrow_managed_exception(...)
at Foundation.NSRunLoop.RunUntil(NSDate date)
at AppDelegate.PresentModalViewController(UIViewController vc, Double duration) in SceneDelegate.cs:line 40
at MonoTouchFixtures.CategoryTest.NavigationControllerOverride()

Analysis

This is a GC race condition: NSAsyncActionDispatcher gets garbage-collected while native code still holds a reference to it. When NSRunLoop.RunUntil() delivers the async callback via xamarinApplySelector, the managed instance is gone and cannot be recreated because Foundation.NSAsyncActionDispatcher lacks a NativeHandle constructor.

The test itself (CategoryTest.NavigationControllerOverride) is about Objective-C category overrides on UINavigationController. The marshalling failure in NSAsyncActionDispatcher is a side effect — an unrelated async dispatch races with the GC during the modal presentation loop.

Classification

This failure was identified as flaky because:


This issue was automatically generated by CI post-mortem analysis.

Metadata

Metadata

Assignees

Labels

bugIf an issue is a bug or a pull request a bug fixci-failureThe issue only affects CIci-postmortemCI post-mortem analysis: flaky tests, infrastructure failures, shared regressionscopilot

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions