Unhandled Exception while Get a Response from Web API in Xamarin android - xamarin

I am creating my first xamarin project with PCL .
I have created WebApi2 with Get Response and publish on my local server which works fine and provides the JSON response correctly
URL : http://test.propertytaxapi.com/api/ward
response :
[{"id":1,"zone_id":1,"ward_no":"1"},{"id":2,"zone_id":1,"ward_no":"2"},{"id":3,"zone_id":1,"ward_no":"3"},{"id":4,"zone_id":1,"ward_no":"4"},{"id":5,"zone_id":1,"ward_no":"5"},{"id":6,"zone_id":1,"ward_no":"6"}]
but when i tried to implement this in my Xamarin project and call it like.
public async Task<List<Ward>> GetData()
{
using (var client = new HttpClient())
{
try
{
client.BaseAddress = new Uri("http://test.propertytaxapi.com/api");
var response = await client.GetAsync("ward");
response.EnsureSuccessStatusCode();
var placesJson = response.Content.ReadAsStringAsync().Result;
Ward wardData = new Ward();
if (placesJson != "")
{
var wlists= JsonConvert.DeserializeObject<List<Ward>>(placesJson);
wardList = wlists.ToList();
}
}
catch (Exception)
{
return null;
}
}
return wardList;
}
I got the exception on this line :-
var response = await client.GetAsync("ward");
Exception:
11-02 14:11:29.968 E/mono ( 2954):
11-02 14:11:29.968 E/mono ( 2954): Unhandled Exception:
11-02 14:11:29.968 E/mono ( 2954): System.Net.Http.HttpRequestException: An error occurred while sending the request ---> System.Net.WebException: Error: NameResolutionFailure
11-02 14:11:29.968 E/mono ( 2954): at System.Net.HttpWebRequest.EndGetResponse (System.IAsyncResult asyncResult) [0x00058] in <6c708cf596db438ebfc6b7e012659eee>:0
11-02 14:11:29.968 E/mono ( 2954): at System.Threading.Tasks.TaskFactory1[TResult].FromAsyncCoreLogic (System.IAsyncResult iar, System.Func2[T,TResult] endFunction, System.Action1[T] endAction, System.Threading.Tasks.Task1[TResult] promise, System.Boolean requiresSynchronization) [0x0000f] in <896ad1d315ca4ba7b117efb8dacaedcf>:0
11-02 14:11:29.968 E/mono ( 2954): --- End of stack trace from previous location where exception was thrown ---
11-02 14:11:29.968 E/mono ( 2954): at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <896ad1d315ca4ba7b117efb8dacaedcf>:0
11-02 14:11:29.968 E/mono ( 2954): at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <896ad1d315ca4ba7b117efb8dacaedcf>:0
11-02 14:11:29.968 E/mono ( 2954): at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <896ad1d315ca4ba7b117efb8dacaedcf>:0
11-02 14:11:29.968 E/mono ( 2954): at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <896ad1d315ca4ba7b117efb8dacaedcf>:0
11-02 14:11:29.968 E/mono ( 2954): at System.Runtime.CompilerServices.ConfiguredTaskAwaitable1+ConfiguredTaskAwaiter[TResult].GetResult () [0x00000] in <896ad1d315ca4ba7b117efb8dacaedcf>:0
11-02 14:11:29.968 E/mono ( 2954): at System.Net.Http.HttpClientHandler+<SendAsync>d__63.MoveNext () [0x00450] in <7736395a6c71409691a34accfc621095>:0
11-02 14:11:29.968 E/mono ( 2954): --- End of inner exception stack trace ---
11-02 14:11:29.976 E/mono-rt ( 2954): [ERROR] FATAL UNHANDLED EXCEPTION: System.Net.Http.HttpRequestException: An error occurred while sending the request ---> System.Net.WebException: Error: NameResolutionFailure
11-02 14:11:29.976 E/mono-rt ( 2954): at System.Net.HttpWebRequest.EndGetResponse (System.IAsyncResult asyncResult) [0x00058] in <6c708cf596db438ebfc6b7e012659eee>:0
11-02 14:11:29.976 E/mono-rt ( 2954): at System.Threading.Tasks.TaskFactory1[TResult].FromAsyncCoreLogic (System.IAsyncResult iar, System.Func2[T,TResult] endFunction, System.Action1[T] endAction, System.Threading.Tasks.Task1[TResult] promise, System.Boolean requiresSynchronization) [0x0000f] in <896ad1d315ca4ba7b117efb8dacaedcf>:0
11-02 14:11:29.976 E/mono-rt ( 2954): --- End of stack trace from previous location where exception was thrown ---
11-02 14:11:29.976 E/mono-rt ( 2954): at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <896ad1d315ca4ba7b117efb8dacaedcf>:0
11-02 14:11:29.976 E/mono-rt ( 2954): at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <896ad1d315ca4ba7b117efb8dacaedcf>:0
11-02 14:11:29.976 E/mono-rt ( 2954): at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <896ad1d315ca4ba7b117efb8dacaedcf>:0
11-02 14:11:29.976 E/mono-rt ( 2954): at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <896ad1d315ca4ba7b117efb8dacaedcf>:0
11-02 14:11:29.976 E/mono-rt ( 2954): at System.Runtime.CompilerServices.ConfiguredTaskAwaitable1+ConfiguredTaskAwaiter[TResult].GetResult () [0x00000] in <896ad1d315ca4ba7b117efb8dacaedcf>:0
11-02 14:11:29.976 E/mono-rt ( 2954): at System.Net.Http.HttpClientHandler+d__63.MoveNext () [0x00450] in <7736395a6c71409691a34accfc621095>:0
11-02 14:11:29.976 E/mono-rt ( 2954): --- End of inner exception stack trace ---
Please suggest me the solution to get response

client.BaseAddress = new Uri("http://test.propertytaxapi.com/api/");
Add backslash at the end of Base address. Try the above uri

Related

System.TypeLoadException Message=VTable setup of type Prism.Autofac.AutofacContainerExtension failed

After update to xamarin forms 3.6->4.2, prism.Autofac.Forms 7.0->7.1, and xamarin.android.support.% 28.0.0.1->28.0.0.3 I'm getting
System.TypeLoadException
Message=VTable setup of type Prism.Autofac.AutofacContainerExtension failed
stack trace:
at Prism.PrismApplicationBase.Initialize () [0x00000] in d:\a\1\s\Source\Xamarin\Prism.Forms\PrismApplicationBase.cs:130
at Prism.PrismApplicationBase.InitializeInternal () [0x00006] in d:\a\1\s\Source\Xamarin\Prism.Forms\PrismApplicationBase.cs:84
at Prism.PrismApplicationBase..ctor (Prism.IPlatformInitializer platformInitializer, System.Boolean setFormsDependencyResolver) [0x00038] in d:\a\1\s\Source\Xamarin\Prism.Forms\PrismApplicationBase.cs:75
at Prism.PrismApplicationBase..ctor (Prism.IPlatformInitializer platformInitializer) [0x00000] in d:\a\1\s\Source\Xamarin\Prism.Forms\PrismApplicationBase.cs:57
at Prism.Autofac.PrismApplication..ctor (Prism.IPlatformInitializer platformInitializer) [0x00000] in D:\a\1\s\Source\Xamarin\Prism.Autofac.Forms\PrismApplication.cs:30
at DisMobi.App..ctor (Prism.IPlatformInitializer initializer) [0x00000] in C:...........\App.xaml.cs:28
at xxxxxx.Droid.MainActivity.OnCreate (Android.OS.Bundle bundle) [0x00079] in C:..........\xxxxxx.Android\MainActivity.cs:35
at Android.App.Activity.n_OnCreate_Landroid_os_Bundle_ (System.IntPtr jnienv, System.IntPtr native__this, System.IntPtr native_savedInstanceState) [0x00011] in :0
at (wrapper dynamic-method) Android.Runtime.DynamicMethodNameCounter.3(intptr,intptr,intptr)

No constructor found in exception but class has the exact constructor

I am sometimes getting the following exception:
Unhandled Exception: Android.Runtime.JavaProxyThrowable: Exception of type 'Android.Runtime.JavaProxyThrowable' was thrown.
--- End of managed Android.Runtime.JavaProxyThrowable stack trace ---
android.runtime.JavaProxyThrowable: System.NotSupportedException: Unable to activate instance of type TaxiTabletUniversal.Droid.Views.SoftMeterView from native handle 0xbe8cfb2c (key_handle 0x369e8281). ---> System.MissingMethodException: No constructor found for TaxiTabletUniversal.Droid.Views.SoftMeterView::.ctor(System.IntPtr, Android.Runtime.JniHandleOwnership) ---> Java.Interop.JavaLocationException: Exception of type 'Java.Interop.JavaLocationException' was thrown.
--- End of inner exception stack trace ---
at Java.Interop.TypeManager.CreateProxy (System.Type type, System.IntPtr handle, Android.Runtime.JniHandleOwnership transfer) [0x00054] in <5ade030ddd6b4e4c9dda56516f1de4fe>:0
at Java.Interop.TypeManager.CreateInstance (System.IntPtr handle, Android.Runtime.JniHandleOwnership transfer, System.Type targetType) [0x00111] in <5ade030ddd6b4e4c9dda56516f1de4fe>:0
--- End of inner exception stack trace ---
at Java.Interop.TypeManager.CreateInstance (System.IntPtr handle, Android.Runtime.JniHandleOwnership transfer, System.Type targetType) [0x0017d] in <5ade030ddd6b4e4c9dda56516f1de4fe>:0
at Java.Lang.Object.GetObject (System.IntPtr handle, Android.Runtime.JniHandleOwnership transfer, System.Type type) [0x000b9] in <5ade030ddd6b4e4c9dda56516f1de4fe>:0
at Java.Lang.Object._GetObject[T] (System.IntPtr handle, Android.Runtime.JniHandleOwnership transfer) [0x00017] in <5ade030ddd6b4e4c9dda56516f1de4fe>:0
at Java.Lang.Object.GetObject[T] (System.IntPtr handle, Android.Runtime.JniHandleOwnership transfer) [0x00000] in <5ade030ddd6b4e4c9dda56516f1de4fe>:0
at Java.Lang.Object.GetObject[T] (System.IntPtr jnienv, System.IntPtr handle, Android.Runtime.JniHandleOwnership transfer) [0x00006] in <5ade030ddd6b4e4c9dda56516f1de4fe>:0
at Android.Views.ViewTreeObserver+IOnGlobalLayoutListenerInvoker.n_OnGlobalLayout (System.IntPtr jnienv, System.IntPtr native__this) [0x00000] in <5ade030ddd6b4e4c9dda56516f1de4fe>:0
at (wrapper dynamic-method) System.Object.90422e09-526e-4347-b02e-8c2980bde53e(intptr,intptr)
at mvvmcross.droid.views.MvxActivity.n_onGlobalLayout(Native Method)
at mvvmcross.droid.views.MvxActivity.onGlobalLayout(MvxActivity.java:84)
at android.view.ViewTreeObserver.dispatchOnGlobalLayout(ViewTreeObserver.java:986)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2221)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1306)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:7031)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:821)
at android.view.Choreographer.doCallbacks(Choreographer.java:606)
at android.view.Choreographer.doFrame(Choreographer.java:576)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:807)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:6914)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1404)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1199)
with the bit that stands out from that exception saying :
No constructor found for TaxiTabletUniversal.Droid.Views.SoftMeterView::.ctor(System.IntPtr, Android.Runtime.JniHandleOwnership)
But the class SoftmeterView (derived from MvxActivity) does have 2 constructors:
public SoftMeterView() : base()
{
MoveTaskToBack(true);
IsCreated = true;
}
with the second one matching the exact signature the exception is complaining about:
public SoftMeterView(IntPtr javaReference, JniHandleOwnership transfer) : base(javaReference, transfer)
{
MoveTaskToBack(true);
IsCreated = true;
}
any thoughts ?

Failed to load assembly from stream: System.AggregateException xamarin Build error

I am trying to build application on xamarin live player but it gives me an error
Failed to load assembly from stream: System.AggregateException: One or more errors occurred. ---> System.AggregateException: One or more errors occurred. ---> System.IO.DirectoryNotFoundException: Could not find a part of the path "/data/data/com.xamarin.live/files/External/.nuget/packages/sqlitepclraw.provider.e_sqlite3.android/1.1.5/lib/MonoAndroid/SQLitePCLRaw.provider.e_sqlite3.dll".
at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize, System.Boolean anonymous, System.IO.FileOptions options) [0x0017d] in <896ad1d315ca4ba7b117efb8dacaedcf>:0
at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share) [0x00000] in <896ad1d315ca4ba7b117efb8dacaedcf>:0
at (wrapper remoting-invoke-with-check) System.IO.FileStream:.ctor (string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare)
at System.IO.File.OpenRead (System.String path) [0x00000] in <896ad1d315ca4ba7b117efb8dacaedcf>:0
at .$LocalFileSystem+Upsight-IFileSystem-OpenReadAsync#49-1.Invoke () [0x00012] in <5a7d391011b47c3aa745038310397d5a>:0
at System.Threading.Tasks.Task1[TResult].InnerInvoke () [0x0000f] in <896ad1d315ca4ba7b117efb8dacaedcf>:0
at System.Threading.Tasks.Task.Execute () [0x00010] in <896ad1d315ca4ba7b117efb8dacaedcf>:0
--- End of inner exception stack trace ---
--- End of inner exception stack trace ---
---> (Inner Exception #0) System.AggregateException: One or more errors occurred. ---> System.IO.DirectoryNotFoundException: Could not find a part of the path "/data/data/com.xamarin.live/files/External/.nuget/packages/sqlitepclraw.provider.e_sqlite3.android/1.1.5/lib/MonoAndroid/SQLitePCLRaw.provider.e_sqlite3.dll".
at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize, System.Boolean anonymous, System.IO.FileOptions options) [0x0017d] in <896ad1d315ca4ba7b117efb8dacaedcf>:0
at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share) [0x00000] in <896ad1d315ca4ba7b117efb8dacaedcf>:0
at (wrapper remoting-invoke-with-check) System.IO.FileStream:.ctor (string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare)
at System.IO.File.OpenRead (System.String path) [0x00000] in <896ad1d315ca4ba7b117efb8dacaedcf>:0
at <StartupCode$Continuous-Core-Droid>.$LocalFileSystem+Upsight-IFileSystem-OpenReadAsync#49-1.Invoke () [0x00012] in <5a7d391011b47c3aa745038310397d5a>:0
at System.Threading.Tasks.Task1[TResult].InnerInvoke () [0x0000f] in <896ad1d315ca4ba7b117efb8dacaedcf>:0
at System.Threading.Tasks.Task.Execute () [0x00010] in <896ad1d315ca4ba7b117efb8dacaedcf>:0
--- End of inner exception stack trace ---
---> (Inner Exception #0) System.IO.DirectoryNotFoundException: Could not find a part of the path "/data/data/com.xamarin.live/files/External/.nuget/packages/sqlitepclraw.provider.e_sqlite3.android/1.1.5/lib/MonoAndroid/SQLitePCLRaw.provider.e_sqlite3.dll".
at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize, System.Boolean anonymous, System.IO.FileOptions options) [0x0017d] in <896ad1d315ca4ba7b117efb8dacaedcf>:0
at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share) [0x00000] in <896ad1d315ca4ba7b117efb8dacaedcf>:0
at (wrapper remoting-invoke-with-check) System.IO.FileStream:.ctor (string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare)
at System.IO.File.OpenRead (System.String path) [0x00000] in <896ad1d315ca4ba7b117efb8dacaedcf>:0
at .$LocalFileSystem+Upsight-IFileSystem-OpenReadAsync#49-1.Invoke () [0x00012] in <5a7d391011b47c3aa745038310397d5a>:0
at System.Threading.Tasks.Task`1[TResult].InnerInvoke () [0x0000f] in <896ad1d315ca4ba7b117efb8dacaedcf>:0
at System.Threading.Tasks.Task.Execute () [0x00010] in <896ad1d315ca4ba7b117efb8dacaedcf>:0
what is the solution for this problem

System.TypeLoadException Could not load type CategoryActivity

I have written an Activity class with following definition
[Activity(Label = "Courses", MainLauncher = true, Icon = "#drawable/icon")]
public class CategoryActivity : ListActivity
{
CourseCategoryManager _courseCategoryManager;
protected override void OnCreate(Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);
_courseCategoryManager = new CourseCategoryManager();
ListAdapter = new CourseCategoryManagerAdapter(this,
global::Android.Resource.Layout.SimpleListItem1,
_courseCategoryManager);
}
}
The purpose of this activity class is to display all categories as List Items.
But when I run the application it returns me following exception:
01-23 14:27:19.157 E/MonoDroid( 2137): Could not load type 'Courses.Android.CategoriesActivity, Courses.Android, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. Skipping JNI registration of type 'md5ba6caf9a9061d0cbb25c0daaef535be4/CategoriesActivity'.
An unhandled exception occured.
01-23 14:27:20.371 I/art ( 2137): Thread[2,tid=2143,WaitingInMainSignalCatcherLoop,Thread*=0xaf478400,peer=0x12c00080,"Signal Catcher"]: reacting to signal 3
01-23 14:27:21.224 I/art ( 2137): Wrote stack traces to '/data/anr/traces.txt'
01-23 14:27:23.305 I/MonoDroid( 2137): UNHANDLED EXCEPTION:
01-23 14:27:23.526 I/MonoDroid( 2137): System.TypeLoadException: Could not load type 'Courses.Android.CategoriesActivity, Courses.Android, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' from assembly ''.
01-23 14:27:23.526 I/MonoDroid( 2137): at (wrapper managed-to-native) System.Type:internal_from_name (string,bool,bool)
01-23 14:27:23.527 I/MonoDroid( 2137): at System.Type.GetType (System.String typeName, Boolean throwOnError) [0x00011] in /Users/builder/data/lanes/2098/3efa14c4/source/mono/mcs/class/corlib/ReferenceSources/Type.cs:57
01-23 14:27:23.527 I/MonoDroid( 2137): at Java.Interop.TypeManager.n_Activate (IntPtr jnienv, IntPtr jclass, IntPtr typename_ptr, IntPtr signature_ptr, IntPtr jobject, IntPtr parameters_ptr) [0x0007b] in /Users/builder/data/lanes/2098/3efa14c4/source/monodroid/src/Mono.Android/src/Java.Interop/TypeManager.cs:145
01-23 14:27:23.527 I/MonoDroid( 2137): at (wrapper dynamic-method) System.Object:90d2a13e-584b-4a05-a439-c9d6ba401669 (intptr,intptr,intptr,intptr,intptr,intptr)
01-23 14:27:23.644 W/art ( 2137): JNI RegisterNativeMethods: attempt to register 0 native methods for md52ce486a14f4bcd95899665e9d932190b.JavaProxyThrowable
An unhandled exception occured.
01-23 14:27:24.452 E/mono ( 2137):
01-23 14:27:24.452 E/mono ( 2137): Unhandled Exception:
01-23 14:27:24.452 E/mono ( 2137): System.TypeLoadException: Could not load type 'Courses.Android.CategoriesActivity, Courses.Android, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' from assembly ''.
01-23 14:27:24.452 E/mono ( 2137): at (wrapper dynamic-method) System.Object:90d2a13e-584b-4a05-a439-c9d6ba401669 (intptr,intptr,intptr,intptr,intptr,intptr)
01-23 14:27:24.452 E/mono ( 2137): at (wrapper native-to-managed) System.Object:90d2a13e-584b-4a05-a439-c9d6ba401669 (intptr,intptr,intptr,intptr,intptr,intptr)
01-23 14:27:24.453 E/mono-rt ( 2137): [ERROR] FATAL UNHANDLED EXCEPTION: System.TypeLoadException: Could not load type 'Courses.Android.CategoriesActivity, Courses.Android, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' from assembly ''.
01-23 14:27:24.453 E/mono-rt ( 2137): at (wrapper dynamic-method) System.Object:90d2a13e-584b-4a05-a439-c9d6ba401669 (intptr,intptr,intptr,intptr,intptr,intptr)
01-23 14:27:24.453 E/mono-rt ( 2137): at (wrapper native-to-managed) System.Object:90d2a13e-584b-4a05-a439-c9d6ba401669 (intptr,intptr,intptr,intptr,intptr,intptr)
referenceTable GDEF length=670 1
referenceTable GSUB length=7202 1
referenceTable GPOS length=24560 1
Uninstall the APK from your device, clean the project and compile on the cell phone or simulator that should remove the problem.

Why do I get this error in Release build: This type is not supported on this platform INullableConverterFactory

Using Xamarin XS v5.5, AutoMapper v3.2.1,
I get this runtime error in Release build (not in Debug):
This type is not supported on this platform INullableConverterFactory
[mono-rt] [ERROR] FATAL UNHANDLED EXCEPTION: System.TypeInitializationException:
An exception was thrown by the type initializer for AutoMapper.Mappers.MapperRegistry --->
System.TypeInitializationException:
An exception was thrown by the type initializer for AutoMapper.Mappers.EnumMapper --->
System.PlatformNotSupportedException: This type is not supported on this platform INullableConverterFactory
[mono-rt] at AutoMapper.Internal.PlatformAdapter.Resolve[INullableConverterFactory] (Boolean throwIfNotFound) [0x00000] in <filename unknown>:0
[mono-rt] at AutoMapper.Mappers.EnumMapper..cctor () [0x00000] in <filename unknown>:0
[mono-rt] --- End of inner exception stack trace ---
[mono-rt] at AutoMapper.Mappers.MapperRegistry..cctor () [0x00000] in <filename unknown>:0
[mono-rt] --- End of inner exception stack trace ---
[mono-rt] at AutoMapper.Mapper.Reset () [0x00000] in <filename unknown>:0
[mono-rt] at AutoMapper.Mapper.Initialize (System.Action`1 action) [0x00000] in <filename unknown>:0
[mono-rt] at MyApp.Android.MainActivity.ConfigMapper () [0x00000] in <filename unknown>:0
[mono-rt] at MyApp.Android.MainActivity.OnCreate (Android.OS.Bundle bundle) [0x00000] in <filename unknown>:0
[mono-rt] at Android.App.Activity.n_OnCreate_Landroid_os_Bundle_ (IntPtr jnienv, IntPtr native__this, IntPtr native_savedInstanceState) [0x00000] in <filename unknown>:0
[mono-rt] at (wrapper dynamic-method) object:3cc570cf-1f33-4513-b6e4-0e910820d0ba (intptr,intptr,intptr)
What could the issue be?
It's most likely the linker removing that type from the AutoMapper assembly..
Usually RELEASE mode has the linker set to SDK Assemblies or ALL Assemblies where as DEBUG doesn't do any linking
Check here how to modify what's linked
https://developer.xamarin.com/guides/cross-platform/advanced/custom_linking/
I had the same exception and adding this fellow in fixed it
<assembly fullname="AutoMapper">
<type fullname="*INullableConverterFactory*" />
<type fullname="*MappingExpression*" />
</assembly>

Resources