Prism + DryIoc + Linker

Created on 15 Dec 2017  路  4Comments  路  Source: PrismLibrary/Prism

Good afternoon,

I'm in the process of exploring Prism to develop some Xamarin Forms Applications.

I used the template extension to scaffold the new project, with DryIoc.
It is using the Prism pre-release version (7.0.0.168-pre).
I created a new view (LoginView), with absolutely no controls inside whatsoever.

If i try to deploy the newly created app to android, without linker enabled, or with the linker set to sdk, it deploys and runs just fine.

If i try to deploy with the linker set to all, it fails with the error:

System.TypeInitializationException: The type initializer for 'Registry' threw an exception. ---> System.TypeInitializationException: The type initializer for 'DryIoc.WrappersSupport' threw an exception. ---> DryIoc.ContainerException: Argument of type MethodInfo is null. 12-15 13:59:56.977 I/MonoDroid(17130): at DryIoc.Throw.ThrowIfNull[T] (T arg, System.Int32 error, System.Object arg0, System.Object arg1, System.Object arg2, System.Object arg3) [0x0002b] in <e3b94bea7996441fb08b4feabdd2e9d9>:0 12-15 13:59:56.977 I/MonoDroid(17130): at DryIoc.WrappersSupport..cctor () [0x0013e] in <e3b94bea7996441fb08b4feabdd2e9d9>:0 12-15 13:59:56.977 I/MonoDroid(17130): --- End of inner exception stack trace --- 12-15 13:59:56.977 I/MonoDroid(17130): --- End of inner exception stack trace --- 12-15 13:59:56.977 I/MonoDroid(17130): at Prism.DryIoc.PrismApplication.CreateContainer () [0x00006] in <f391f9c2cac64683a56d0cb59825014a>:0 12-15 13:59:56.977 I/MonoDroid(17130): at Prism.PrismApplicationBase1[T].Initialize () [0x0001e] in :0
12-15 13:59:56.977 I/MonoDroid(17130): at Prism.PrismApplicationBase1[T].InitializeInternal () [0x00006] in <feb5c9b233df462bb483ff4dd8463238>:0 12-15 13:59:56.978 I/MonoDroid(17130): at Prism.PrismApplicationBase1[T]..ctor (Prism.IPlatformInitializer1[T] initializer) [0x00031] in <feb5c9b233df462bb483ff4dd8463238>:0 12-15 13:59:56.978 I/MonoDroid(17130): at Prism.DryIoc.PrismApplication.set_ModuleCatalog (Prism.Modularity.IModuleCatalog value) [0x00000] in <f391f9c2cac64683a56d0cb59825014a>:0 12-15 13:59:56.978 I/MonoDroid(17130): at CABuffet.App..ctor (Prism.DryIoc.IPlatformInitializer initializer) [0x00000] in C:\Projects\CABuffet\CABuffet\CABuffet\App.xaml.cs:18 12-15 13:59:56.978 I/MonoDroid(17130): at CABuffet.Droid.MainActivity.OnCreate (Android.OS.Bundle bundle) [0x00027] in C:\Projects\CABuffet\CABuffet\CABuffet.Android\MainActivity.cs:20

I have created my own LinkerDescription file to preserve the members, yet i have little experience with linker.

```













```

Can anyone point me into the right direction?

Package info

  • Platform: Xamarin Forms
  • Prism version: 7.0.0.168-pre
  • Xamarin version (if applicable): Xamarin Android 8.1.0.25
  • Other version info: .NetStandard v2.0

Repro steps

  1. Use the Prism Project Template to create a new Prism Application
  2. Select DryIoc as your container
  3. Create a new View and ViewModel using the Prism Item Template
  4. Set Android Linker Settings to All
  5. Deploy to a simulator

Most helpful comment

This is my basic linker config for Dryioc that I use, using all this gives to me 25mb size. But, obviously, you need to refine, add and remove things. Its a good start. ( It basic skip things ^_^' )

This is a NETStandard.Library, using Xamarin.forms 2.5.0.91635

<assembly fullname="SQLite-net">
    <type fullname="*" />
  </assembly>

    <assembly fullname="SQLitePCLRaw.batteries_v2">
    <type fullname="*" />
  </assembly>

    <assembly fullname="SQLitePCLRaw.core">
    <type fullname="*" />
  </assembly>

  <assembly fullname="DryIoc">
    <type fullname="*" />
  </assembly>

  <assembly fullname="System">
    <type fullname="*" />
  </assembly>

  <assembly fullname="mscorlib">
    <type fullname="*" />
  </assembly>

  <assembly fullname="Prism">
    <type fullname="*" />
  </assembly>

  <assembly fullname="Prism.DryIoc.Forms">
    <type fullname="*" />
  </assembly>

  <assembly fullname="MyProjectPCL">
    <type fullname="*" />
  </assembly>

  <assembly fullname="Prism.Forms">
    <type fullname="*" />
  </assembly>

  <assembly fullname="Plugin.Permissions">
    <type fullname="*" />
  </assembly>

  <assembly fullname="Xamarin.Forms.Maps">
    <type fullname="*" />
  </assembly>

  <assembly fullname="Newtonsoft.Json">
    <type fullname="*" />
  </assembly>

All 4 comments

You should reach out to the Xamarin forums for help with their platform. When you get an answer, you can place the answer here to help anyone else with a similar question.

This is my basic linker config for Dryioc that I use, using all this gives to me 25mb size. But, obviously, you need to refine, add and remove things. Its a good start. ( It basic skip things ^_^' )

This is a NETStandard.Library, using Xamarin.forms 2.5.0.91635

<assembly fullname="SQLite-net">
    <type fullname="*" />
  </assembly>

    <assembly fullname="SQLitePCLRaw.batteries_v2">
    <type fullname="*" />
  </assembly>

    <assembly fullname="SQLitePCLRaw.core">
    <type fullname="*" />
  </assembly>

  <assembly fullname="DryIoc">
    <type fullname="*" />
  </assembly>

  <assembly fullname="System">
    <type fullname="*" />
  </assembly>

  <assembly fullname="mscorlib">
    <type fullname="*" />
  </assembly>

  <assembly fullname="Prism">
    <type fullname="*" />
  </assembly>

  <assembly fullname="Prism.DryIoc.Forms">
    <type fullname="*" />
  </assembly>

  <assembly fullname="MyProjectPCL">
    <type fullname="*" />
  </assembly>

  <assembly fullname="Prism.Forms">
    <type fullname="*" />
  </assembly>

  <assembly fullname="Plugin.Permissions">
    <type fullname="*" />
  </assembly>

  <assembly fullname="Xamarin.Forms.Maps">
    <type fullname="*" />
  </assembly>

  <assembly fullname="Newtonsoft.Json">
    <type fullname="*" />
  </assembly>

Hey, thanks for that!

It's working perfectly, thanks a lot! :)

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings