[mono-android] possible linker issue with IoC

Matthew Groves mgroves1120 at gmail.com
Mon Mar 14 14:20:14 EDT 2011


I'm using an IoC container to wire up dependencies.  If I wire them up like
so:

MyIoC.Register<IWhatever, Whatever>()

Then the IoC container is unable to find a constructor at runtime (via
GetContructors using reflection).

However, if I register like so:

MyIoC.Register<IWhatever>(() => new Whatever(...potentially long series of
dependencies...));

Then it works fine.

So my question: is this because of the linker?  In the first example, the
constructor would only be used via Reflection, and thus the linker could
overlook it and exclude the constructor?  If so, is there a way to tell the
linker to always include the constructors, or some other workaround?

Thanks,

Matt
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/mailman/private/monodroid/attachments/20110314/c3c2b661/attachment.html 


More information about the Monodroid mailing list