Note that there are some explanatory texts on larger screens.

plurals
  1. POXamarin Android - Linker and ServiceStack.Text
    primarykey
    data
    text
    <p>I'm having trouble getting an application to work with full linking. This is my setup (my assembly names changed):</p> <ul> <li>Mono for Android 4.4.54</li> <li>An Android application (<em>MyApp</em>)</li> <li>A platform agnostic library (<em>MyLib</em>)</li> </ul> <p>I'm attempting to deserialise a type (Person) from JSON text using ServiceStack.Text. It works fine when only linking SDK assemblies.</p> <p>Rather than put linker include attributes in <em>MyLib</em>, I'm using a <em>LinkDescription</em> XML file in <em>MyApp</em>. It looks like this:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8" ?&gt; &lt;linker&gt; &lt;assembly fullname="MyLib"&gt; &lt;type fullname="MyLib.Person" preserve="fields"&gt; &lt;method name=".ctor" /&gt; &lt;/type&gt; &lt;/assembly&gt; &lt;/linker&gt; </code></pre> <p>This is my logcat output:</p> <pre><code>E/MyApp(14494): InitialiseUser(): System.TypeInitializationException: An exception was thrown by the type initializer for ServiceStack.Text.Json.JsonReader`1 ---&gt; System.ArgumentNullException: Argument cannot be null. E/MyApp(14494): Parameter name: method E/MyApp(14494): at System.Delegate.CreateDelegate (System.Type type, System.Object firstArgument, System.Reflection.MethodInfo method, Boolean throwOnBindFailure, Boolean allowClosed) [0x00000] in &lt;filename unknown&gt;:0 E/MyApp(14494): at System.Delegate.CreateDelegate (System.Type type, System.Reflection.MethodInfo method, Boolean throwOnBindFailure) [0x00000] in &lt;filename unknown&gt;:0 E/MyApp(14494): at ServiceStack.Text.PlatformExtensions.MakeDelegate (System.Reflection.MethodInfo mi, System.Type delegateType, Boolean throwOnBindFailure) [0x00000] in &lt;filename unknown&gt;:0 E/MyApp(14494): at ServiceStack.Text.Json.JsonReader.GetParseFn (System.Type type) [0x00000] in &lt;filename unknown&gt;:0 E/MyApp(14494): at ServiceStack.Text.Json.JsonTypeSerializer.GetParseFn (System.Type type) [0x00000] in &lt;filename unknown&gt;:0 E/MyApp(14494): at ServiceStack.Text.Common.TypeAccessor.Create (ITypeSerializer serializer, ServiceStack.Text.TypeConfig typeConfig, System.Reflection.PropertyInfo propertyInfo) [0x00000] in &lt;filename unknown&gt;:0 E/MyApp(14494): at ServiceStack.Text.Common.DeserializeTypeRef.GetTypeAccessorMap (ServiceStack.Text.TypeConfig typeConfig, ITypeSerializer serializer) [0x00000] in &lt;filename unknown&gt;:0 E/MyApp(14494): at ServiceStack.Text.Common.DeserializeType`1[ServiceStack.Text.Json.JsonTypeSerializer].GetParseMethod (ServiceStack.Text.TypeConfig typeConfig) [0x00000] in &lt;filename unknown&gt;:0 E/MyApp(14494): at ServiceStack.Text.Common.JsReader`1[ServiceStack.Text.Json.JsonTypeSerializer].GetCoreParseFn[Person] () [0x00000] in &lt;filename unknown&gt;:0 E/MyApp(14494): at ServiceStack.Text.Common.JsReader`1[ServiceStack.Text.Json.JsonTypeSerializer].GetParseFn[Person] () [0x00000] in &lt;filename unknown&gt;:0 E/MyApp(14494): at ServiceStack.Text.Json.JsonReader`1[MyLib.Person]..cctor () [0x00000] in &lt;filename unknown&gt;:0 E/MyApp(14494): --- End of inner exception stack trace --- E/MyApp(14494): at ServiceStack.Text.JsonSerializer.DeserializeFromString[Person] (System.String value) [0x00000] in &lt;filename unknown&gt;:0 E/MyApp(14494): at MyLib.Person.FromJson (System.String json, Boolean throwOnNullOrEmpty) [0x00000] in &lt;filename unknown&gt;:0 E/MyApp(14494): at MyApp.MainActivity.InitialiseUser () [0x00000] in &lt;filename unknown&gt;:0 </code></pre> <p>After this, my instance of Person is null.</p> <p>It seems from the output that the default constructor of Person can't be found (it has no explicitly defined constructor).</p> <p>Any help much appreciated.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload