seesharper / LightInject.Interception

LightInject.Interception supports Aspect Oriented Programming through proxy-based method interceptors.
11 stars 7 forks source link

Xamarin.iOS AOT #20

Closed xlievo closed 6 years ago

xlievo commented 6 years ago

Do you support Xamarin.iOS AOT mode? as far as I know, Castle.Core is not acceptable.

seesharper commented 6 years ago

Hi @xlievo

I am afraid that is not possible on AOT platforms. Interception means creating new types at runtime and that can't be done since all types must be known ahead of time (AOT).

xlievo commented 6 years ago

OK, thank you for your quick reply.

xlievo commented 6 years ago

As far as I know, Xamarin.android is acceptable. Does this mean that you can never intercept on Xamarin.IOS?

seesharper commented 6 years ago

One should never say never, but the general restriction is that you can't generate code at runtime on iOS. This means everything from the Reflection.Emit namespace that represents generating code. LambdaExpression.Compile works through interpretation, but that does not require new types since you can't create new types using expression trees.