Xamarin Linker: default constructor not found for type Cirrious.CrossCore.IoC.MvxPropertyInjector

With the design of the skeleton with the FirstView package from the HotTuna package and with the layout builder set to "Link all assemblies", I get the following error:

System.MissingMethodException: default constructor not found for type Cirrious.CrossCore.IoC.MvxPropertyInjector

Using the nuGet v3.1.1 package for all MvvmCross (4 packages)

The LinkerPleaseInclude file has the line [MonoTouch.Foundation.Preserve (AllMembers = true)]

Using the latest stable build:

On PC: Xamarin for VS 1.12.278 Xamarin.iOS 1.12.278

Mac: Xamarin.iOS 7.2.2.2

Of course, using only the Linker SDK behavior, it works fine. Any suggestions anyone?

+4
source share
2 answers

solvable; So, with the base project, there were three consecutive errors in the following order:

System.MissingMethodException: Default constructor not found for type Cirrious.CrossCore.IoC.MvxPropertyInjector
  • can be resolved either using -linkskip = Cirrious.Core (ugly), or by including in LinkerPleaseInclude.cs

    public void Include(MvxPropertyInjector injector){
        injector = new MvxPropertyInjector ();
    } 
    

The following error:

    Cirrious.CrossCore.Exceptions.MvxException: Failed to construct and initialize ViewModel for type {0} from locator MvxDefaultViewModelLocator - check MvxTrace for more information

It's complicated; A simple fix is, of course, to make the link --linkskip = portableLibrary or create an instance of ViewModel somewhere (possibly in LinkerPleaseInclude.cs); the problem with the second approach, at least in my case, most of my virtual machine does not have a constructor with a lower value, and obviously, using IOC in this case would not help.

Final error:

System.ArgumentNullException: missing source event info in MvxWeakEventSubscription
Parameter name: sourceEventInfo

--linkskip = System (), LinkerPleaseInclude.cs

    public void Include(INotifyPropertyChanged changed)
    {
        changed.PropertyChanged += (sender, e) =>  {
            var test = e.PropertyName;
        };
    }

LinkAllAssemblies, LLVM SGen.

, , .

+8

, XCode Xamarin Mac. XCode .

+1

Source: https://habr.com/ru/post/1540036/


All Articles