Skip to content

Xamarin.iOS Reflection Limits

Question

Is there any limitation in reflection in Xamarin.iOS? Emit, access to non-public api.

Short interview answer

iOS ahead-of-time compilation and platform policy constrain dynamic techniques. Do not depend on runtime code generation or private platform APIs; preserve only reflection metadata that a supported release feature needs.

Detailed answer

Treat dynamic invocation as a deployment concern, not just a language feature. Validate the release build on device, avoid private Apple APIs, and use supported bindings or generated code where possible. A library that relies on reflection needs explicit trimming/AOT review.

Sources