Autofac quit allows constructors in iOS after Xamarin update

So, I have updated my Xamarin version today to the latest stable release. As of update, my app won't work on iOS (works fine on Android) ... the error is that it can't resolve the constructor.

Autofac.Core.DependencyResolutionException: Constructors of type 'FutureState.AppCore.Migrations.Migration001' cannot be found by finder constructor 'Autofac.Core.Activators.Reflection.DefaultConstructorFinder'.

My original constructor

    public Migration001(IUserRepository userRepository,
                        IRoleRepository roleRepository,
                        IPermissionRepository permissionRepository,
                        IPasswordHasher passwordHasher)
    {
        _userRepository = userRepository;
        _roleRepository = roleRepository;
        _permissionRepository = permissionRepository;
        _passwordHasher = passwordHasher;
        MigrationVersion = 1;
    }

      

but I even tried changing it to a service location to see if Autofac finds the constructor.

    public Migration001()
    {
        _userRepository = App.Container.Resolve<IUserRepository>();
        _roleRepository = App.Container.Resolve<IRoleRepository>();
        _permissionRepository = App.Container.Resolve<IPermissionRepository>();
        _passwordHasher = App.Container.Resolve<IPasswordHasher>();
        MigrationVersion = 1;
    }

      

but unfortunately this leads to the same problem.

Autofac.Core.DependencyResolutionException: Constructors of type 'FutureState.AppCore.Migrations.Migration001' cannot be found by finder constructor 'Autofac.Core.Activators.Reflection.DefaultConstructorFinder'.

what could cause something like this? This is a Xamarin.Forms app, so the same code runs without issue on Android.

+3


source to share


2 answers


It looks like it was a problem with the release of Xamarian at the time. I updated to the latest version (yesterday) and no longer have this problem.



Also, there are many bugs in the September 2014 releases, so if you are using 3.5 ... upgrade.

+1


source


I had a similar problem after updating the Xamarin iOS SDK to Alpha (3.9.289). Changing Linker behavior to "Do not link" solved my problem.



+2


source







All Articles