4

So I updated my Xamarin install today to the latest stable version. Since the update, my app won't run on iOS (runs fine on Android)... the error is that it can't resolve the constructor.

Autofac.Core.DependencyResolutionException: No constructors on type 'FutureState.AppCore.Migrations.Migration001' can be found with the constructor finder 'Autofac.Core.Activators.Reflection.DefaultConstructorFinder'.

My original constructor is

    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 service location just to see if Autofac would find 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, it results in the exact same issue.

Autofac.Core.DependencyResolutionException: No constructors on type 'FutureState.AppCore.Migrations.Migration001' can be found with the constructor finder 'Autofac.Core.Activators.Reflection.DefaultConstructorFinder'.

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

Chase Florell
  • 46,378
  • 57
  • 186
  • 376

3 Answers3

2

Looks like it was an issue with the Xamarian release at that time. I've re-updated to the latest version (yesterday) and no longer have this issue.

Further there were a number of breaking bugs in the September 2014 releases, so if you're on 3.5... upgrade.

Chase Florell
  • 46,378
  • 57
  • 186
  • 376
2

I had similar issue after upgrading Xamarin iOS SDK to Alpha (3.9.289). Changing Linker Behaviour to 'Don't link' solved my problem.

veeroo
  • 752
  • 6
  • 25
1

Changing Linker Behaviour to Link Framework SDKs Only solved my problem.

Shruti Thombre
  • 989
  • 4
  • 11
  • 27