Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

TinyIoC, Xamarin.iOS, Linker

$
0
0

Hey all. I'm trying to get TinyIoC working on Xamarin.iOS, but I'm not having a lot of luck. My project linker settings are set to "Link SDK assemblies only".

I'm literally doing something this simple:

public interface IPerson { int age { get; } }
public class Person : IPerson { public int age { get { return 99; } } }

Then my registration code looks like this (I've just placed it in my AppDelegate in a toy app):

TinyIoCContainer.Current.Register<IPerson,Person>.AsMultiInstance();

When I attempt to grab an IPerson, I get a runtime exception saying that IPerson cannot be resolved (this code is found immediately after the registration code in the AppDelegate of the toy app):

IPerson person = TinyIoCContainer.Current.Resolve<IPerson>();

When I build and run, I receive a runtime error on the Resolve call:

Unable to resolve type: TinyTest.IPerson

If, however, I change the linker settings to "Don't link", everything works fine. This is obviously untenable, though, because the binary becomes enormous.

I've tried placing [Preserve] attributes on the IPerson interface and the Person class, but no dice.

Feel like I'm missing something here - can someone point me in the right direction?

Thank you, Brad


Viewing all articles
Browse latest Browse all 204402

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>