Akavache icon indicating copy to clipboard operation
Akavache copied to clipboard

Link all assemblies does not work on Xamarin IOS

Open jorgenstorlie opened this issue 10 years ago • 8 comments
trafficstars

If I use Link all assemblies I got this error then I try to run the app.

(If I use link SDK assemblies it works, but I want to link all.)

2015-08-14 14:27:08.872 ContendoiOS[2354:29573] Unhandled managed exception: An exception was thrown by the type initializer for Splat.LogHost (System.TypeInitializationException) at Akavache.BlobCache.EnsureInitialized () [0x00000] in :0 at Contendo.ContendoService..ctor () [0x00000] in :0 at Contendo.iOS.iOSContendoService..ctor () [0x00000] in :0 at Contendo.iOS.AppDelegate.FinishedLaunching (UIKit.UIApplication app, Foundation.NSDictionary options) [0x00000] in :0 at (wrapper managed-to-native) UIKit.UIApplication:UIApplicationMain (int,string[],intptr,intptr) at UIKit.UIApplication.Main (System.String[] args, IntPtr principal, IntPtr delegate) [0x00000] in :0 at UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x00000] in :0 at Contendo.iOS.AppDelegate.Main (System.String[] args) [0x00000] in :0 --- inner exception --- Could not load type 'Splat.WrappingFullLogger' from assembly 'Splat, Version=1.6.2.0, Culture=neutral, PublicKeyToken=null'. (System.TypeLoadException) (null)

How can I fix this?

jorgenstorlie avatar Aug 14 '15 12:08 jorgenstorlie

this is probably too late for you, but might help other people. I have had a similar problem and the solution for me was to add the following to the additional mtouch arguments: "--linkskip=Akavache --linkskip=Newtonsoft.Json"

enter-is avatar Nov 24 '15 17:11 enter-is

I'm doing Link All, and no matter what I do, even with linkskip, with adding Akavache into link.xml, I am still unable to get Akavache to detect/use its SQLite backend.

If I try to use SQLitePersistentBlobCache directly, I get the following Reflection exception:

System.ArgumentException: Get Method not found for 'Version'
  at System.Reflection.MonoProperty.GetValue (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] index, System.Globalization.CultureInfo culture) [0x0006e] in /Users/builder/data/lanes/3969/7beaef43/source/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/corlib/System.Reflection/MonoProperty.cs:426 
  at System.Reflection.MonoProperty.GetValue (System.Object obj, System.Object[] index) [0x0000e] in /Users/builder/data/lanes/3969/7beaef43/source/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/corlib/System.Reflection/MonoProperty.cs:405 
  at Akavache.Sqlite3.Internal.TableMapping+Column.GetValue (System.Object obj) [0x00000] in C:\projects\akavache\src\Akavache.Sqlite3\SQLite.cs:1877 
  at Akavache.Sqlite3.Internal.SQLiteConnection.Insert (System.Object obj, System.String extra, System.Type objType) [0x000b3] in C:\projects\akavache\src\Akavache.Sqlite3\SQLite.cs:1290 
  at Akavache.Sqlite3.Internal.SQLiteConnection.Insert (System.Object obj) [0x00005] in C:\projects\akavache\src\Akavache.Sqlite3\SQLite.cs:1143 
  at Akavache.Sqlite3.SQLitePersistentBlobCache+<<Initialize>b__33_0>d.MoveNext () [0x0011c] in C:\projects\akavache\src\Akavache.Sqlite3\SqlitePersistentBlobCacheNext.cs:273 

I have also tried adding Akavache and dependencies directly into link.xml, where I have other libraries that I am avoiding using the linker on:

 <assembly fullname="Newtonsoft.Json"></assembly>
  <assembly fullname="System.Reactive.Linq"></assembly>
  <assembly fullname="System.Runtime.Serialization"></assembly>
  <assembly fullname="Akavache.Sqlite3">
	<namespace fullname="Akavache.Sqlite3.*" preserve="all" />
	<namespace fullname="Akavache.Sqlite3.Internal.*" preserve="all" />		
  </assembly>
  <assembly fullname="Akavache">
	<namespace fullname="Akavache.*" preserve="all" />
  </assembly>
  <assembly fullname="Splat">
	<namespace fullname="Splat.*" preserve="all" />
  </assembly>
  <assembly fullname="SQLitePCLRaw.core">
	<namespace fullname="SQLitePCLRaw.*" preserve="all" />
  </assembly>

thedracle avatar Feb 01 '17 21:02 thedracle

@thedracle We are having the same issues with our Android app. Did you find a solution for these issues?

MaximST92 avatar Feb 28 '18 09:02 MaximST92

+1 I'm also experiencing this on Android

btodts avatar Mar 05 '18 12:03 btodts

+1 today in 2020. I have the same issue from AppCenter Diagnostics

TableMapping+Column.GetValue (System.Object obj) System.ArgumentException: Get Method not found for 'Version'

Before I had some issues cause the app was missing some dependencies, so I wrote this conf

<?xml version="1.0" encoding="utf-8" ?>
<linker>
...
  <assembly fullname="Akavache.Sqlite3">
    <type fullname="Akavache.Sqlite3.Registrations" preserve="all">
      <method name=".ctor" />
    </type>
  </assembly>
...
</linker>

Any update on this?

luismts avatar Oct 02 '20 21:10 luismts

@luismts even with the LinkDescription i am getting the Default constructor not found for type Akavache.Sqlite3.Registrations Did you workaround it other way?

gsgou avatar Feb 25 '21 17:02 gsgou

in iOS what worked for me sofar was: <MtouchExtraArgs>--linkskip=Akavache --linkskip=Akavache.Sqlite3</MtouchExtraArgs>

gsgou avatar Feb 25 '21 18:02 gsgou

I confirm that adding <AndroidLinkSkip>Akavache;Akavache.Sqlite3</AndroidLinkSkip> to the Android project .csproj helped resolve the problem.

SuperCorks avatar Apr 18 '22 23:04 SuperCorks