Java.Lang.IllegalStateException while using FormsAppCompatActivity in Xamarin Android - xamarin

The Xamarin android code is giving runtime exception when used with following code:
public class MyActivity: global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity
{
protected override void OnCreate(Bundle bundle)
{
ToolbarResource = Resource.Layout.toolbar;
TabLayoutResource = Resource.Layout.tabs;
base.OnCreate(bundle);
global::Xamarin.Forms.Forms.Init(this, bundle);
LoadApplication(new App());
}
}
When running the app, its builds successfully. But in Runtime iot gets into following error StackTrace:
Java.Lang.IllegalStateException: Exception of type 'Java.Lang.IllegalStateException' was thrown.
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () <IL 0x00011, 0x00078>
at Android.Runtime.JNIEnv.CallIntMethod (intptr,intptr) <IL 0x00069, 0x00297>
at Android.Support.V4.App.FragmentTransactionInvoker.Commit () <IL 0x00038, 0x00143>
at Xamarin.Forms.Platform.Android.AppCompat.NavigationPageRenderer.SwitchContentAsync (Xamarin.Forms.Page,bool,bool,bool) <IL 0x00140, 0x00953>
at Xamarin.Forms.Platform.Android.AppCompat.NavigationPageRenderer.OnPushAsync (Xamarin.Forms.Page,bool) <IL 0x00005, 0x00063>
at Xamarin.Forms.Platform.Android.AppCompat.NavigationPageRenderer.PushViewAsync (Xamarin.Forms.Page,bool) <IL 0x00003, 0x00053>
at Xamarin.Forms.Platform.Android.AppCompat.NavigationPageRenderer.<OnElementChanged>b__13_0 (Xamarin.Forms.Page) <IL 0x00003, 0x0004f>
at Xamarin.Forms.EnumerableExtensions.ForEach<Xamarin.Forms.Page> (System.Collections.Generic.IEnumerable`1<Xamarin.Forms.Page>,System.Action`1<Xamarin.Forms.Page>) <0x00157>
An unhandled exception occured.
at Xamarin.Forms.Platform.Android.AppCompat.NavigationPageRenderer.OnElementChanged (Xamarin.Forms.Platform.Android.ElementChangedEventArgs`1<Xamarin.Forms.NavigationPage>) <IL 0x001bb, 0x00e0f>
at Xamarin.Forms.Platform.Android.VisualElementRenderer`1<Xamarin.Forms.NavigationPage>.SetElement (Xamarin.Forms.NavigationPage) <0x00827>
at Xamarin.Forms.Platform.Android.VisualElementRenderer`1<Xamarin.Forms.NavigationPage>.Xamarin.Forms.Platform.Android.IVisualElementRenderer.SetElement (Xamarin.Forms.VisualElement) <0x0012b>
at Xamarin.Forms.Platform.Android.Platform.CreateRenderer (Xamarin.Forms.VisualElement) <IL 0x00021, 0x0014f>
at Xamarin.Forms.Platform.Android.MasterDetailContainer.set_ChildView (Xamarin.Forms.VisualElement) <IL 0x00049, 0x001df>
at Xamarin.Forms.Platform.Android.AppCompat.MasterDetailPageRenderer.UpdateDetail () <IL 0x0001d, 0x000e3>
at Xamarin.Forms.Platform.Android.AppCompat.MasterDetailPageRenderer.HandlePropertyChanged (object,System.ComponentModel.PropertyChangedEventArgs) <IL 0x0002c, 0x00157>
at (wrapper delegate-invoke) <Module>.invoke_void_object_PropertyChangedEventArgs (object,System.ComponentModel.PropertyChangedEventArgs) <IL 0x0002f, 0x0008b>
at Xamarin.Forms.BindableObject.OnPropertyChanged (string) <IL 0x00012, 0x000d7>
at Xamarin.Forms.Element.OnPropertyChanged (string) <IL 0x00002, 0x0005f>
at Xamarin.Forms.MasterDetailPage.set_Detail (Xamarin.Forms.Page) <IL 0x0007b, 0x002eb>
at eWorker.App.SetRootPage (Xamarin.Forms.Page) [0x00025] in C:\SIProducts\360\Dev\Frontend\BugFixes\Source\BIF\Source\eWorker\XamarinApp\Shared\eWorkerShared\App.cs:97
at eWorker.Views.HomePage.OnAppearing () [0x0000e] in C:\SIProducts\360\Dev\Frontend\BugFixes\Source\BIF\Source\eWorker\XamarinApp\Shared\eWorkerShared\Views\HomePage.cs:39
at Xamarin.Forms.Page.SendAppearing () <IL 0x00025, 0x0011f>
at Xamarin.Forms.Platform.Android.AppCompat.FragmentContainer.set_UserVisibleHint (bool) <IL 0x0004b, 0x002a3>
at Xamarin.Forms.Platform.Android.AppCompat.NavigationPageRenderer/<>c__DisplayClass52_0.<SwitchContentAsync>b__1 () <IL 0x00014, 0x0008f>
at Xamarin.Forms.Forms/AndroidPlatformServices/<>c__DisplayClass17_0.<StartTimer>b__1 () <IL 0x00006, 0x00053>
at Java.Lang.Thread/RunnableImplementor.Run () <IL 0x00011, 0x00097>
at Java.Lang.IRunnableInvoker.n_Run (intptr,intptr) <IL 0x0000a, 0x000a3>
at (wrapper dynamic-method) object.ba4e6bb4-0814-4b71-9867-78bee59c6f1f (intptr,intptr) <IL 0x00011, 0x0003b>
--- End of managed exception stack trace ---
java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState
at android.support.v4.app.FragmentManagerImpl.checkStateLoss(FragmentManager.java:1448)
at android.support.v4.app.FragmentManagerImpl.enqueueAction(FragmentManager.java:1466)
at android.support.v4.app.BackStackRecord.commitInternal(BackStackRecord.java:634)
at android.support.v4.app.BackStackRecord.commit(BackStackRecord.java:613)
at mono.java.lang.RunnableImplementor.n_run(Native Method)
at mono.java.lang.RunnableImplementor.run(RunnableImplementor.java:29)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:146)
at android.app.ActivityThread.main(ActivityThread.java:5603)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1283)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099)
at dalvik.system.NativeStart.main(Native Method)
03): Shutting down VM
hreadid=1: thread exiting with uncaught exception (group=0x41b6bc08)
This error occurs at points where Navigation.PushAsync or Navigation.PushModalAsync is called.

After some R&D I found that the issue is while it saves the previous stage of App. It worked when the old app is manually removed and then the App is installed while debugging.
But this can not be a proper solution, so any suggestions/help is welcomed.

Related

Xamarin app build error with Android 12.0 (S)

Here's the error :
System.InvalidOperationException: Duplicate Attribute.
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(3,3): Error XAGJS7009: System.InvalidOperationException: Duplicate attribute.
at System.Xml.Linq.XElement.AddAttributeSkipNotify (System.Xml.Linq.XAttribute a) [0x00030] in /Users/builder/jenkins/workspace/build-package-osx-mono/2020-02/external/bockbuild/builds/mono-x64/external/corefx/src/System.Private.Xml.Linq/src/System/Xml/Linq/XElement.cs:1929
at System.Xml.Linq.XContainer.AddContentSkipNotify (System.Object content) [0x00032] in /Users/builder/jenkins/workspace/build-package-osx-mono/2020-02/external/bockbuild/builds/mono-x64/external/corefx/src/System.Private.Xml.Linq/src/System/Xml/Linq/XContainer.cs:486
at System.Xml.Linq.XContainer.Add (System.Object content) [0x00008] in /Users/builder/jenkins/workspace/build-package-osx-mono/2020-02/external/bockbuild/builds/mono-x64/external/corefx/src/System.Private.Xml.Linq/src/System/Xml/Linq/XContainer.cs:140
at Xamarin.Android.Tasks.ManifestDocument.AddLauncherIntentElements (System.Xml.Linq.XElement activity) [0x0004e] in <256050d9b61b4848876345a052636c75>:0
at Xamarin.Android.Tasks.ManifestDocument+<>c__DisplayClass99_0.<ActivityFromTypeDefinition>b__1 (Android.App.ActivityAttribute aa, System.Xml.Linq.XElement element) [0x00008] in <256050d9b61b4848876345a052636c75>:0
at Xamarin.Android.Tasks.ManifestDocument.ToElement[TAttribute] (Mono.Cecil.TypeDefinition type, System.String name, System.Func`2[T,TResult] parser, System.Func`2[T,TResult] toElement, System.Action`2[T1,T2] update) [0x0007d] in <256050d9b61b4848876345a052636c75>:0
at Xamarin.Android.Tasks.ManifestDocument.ActivityFromTypeDefinition (Mono.Cecil.TypeDefinition type, System.String name, System.Int32 targetSdkVersion) [0x00043] in <256050d9b61b4848876345a052636c75>:0
at Xamarin.Android.Tasks.ManifestDocument.Merge (Microsoft.Build.Utilities.TaskLoggingHelper log, Java.Interop.Tools.Cecil.TypeDefinitionCache cache, System.Collections.Generic.List`1[T] subclasses, System.String applicationClass, System.Boolean embed, System.String bundledWearApplicationName, System.Collections.Generic.IEnumerable`1[T] mergedManifestDocuments) [0x004c2] in <256050d9b61b4848876345a052636c75>:0
at Xamarin.Android.Tasks.GenerateJavaStubs.Run (Java.Interop.Tools.Cecil.DirectoryAssemblyResolver res) [0x00766] in <256050d9b61b4848876345a052636c75>:0
at Xamarin.Android.Tasks.GenerateJavaStubs.RunTask () [0x0000e] in <256050d9b61b4848876345a052636c75>:0
at Microsoft.Android.Build.Tasks.AndroidTask.Execute () [0x00000] in /Users/builder/azdo/_work/1/s/xamarin-android/external/xamarin-android-tools/src/Microsoft.Android.Build.BaseTasks/AndroidTask.cs:17 (XAGJS7009) (AppName.UI.Droid)
It only appears when I target android 12
The solution was to remove the explicit exported flag for the activity, that I have added before because of the error it was giving me when targeting Android SDK 11.0.99
I have only removed the splash screen exported flag and the app runs normally
Here is the issue information: https://github.com/xamarin/xamarin-android/issues/6463

How to properly map an expected DLL name to a native Mac framework for Mono

I am trying to use the Chromium Embedded Framework.framework in my Mac app. In my sample .net code, this framework is referenced as libcef.dll. When I call a method on the framework, I get a System.DllNotFound exception. I have looked at DLL maps to map the CEF framework on the Mac to the expected DLL name of libcef.dll and I have the following map but this did not resolve the issue.
<configuration>
<dllmap dll="libcef.dll" target=" /Library/Frameworks/Chromium Embedded Framework.framework/Chromium Embedded Framework"/>
</configuration>
I have also added the framework to my project within Visual Studio 2017 for Mac as a native reference but nor did this resolve the issue.
Does anyone know how I might be able to get around this DllNotFound exception?
Here is the stack track that I get when the DLLNotFound Exception is thrown:
System.DllNotFoundException: libcef
at at (wrapper managed-to-native) Xilium.CefGlue.Interop.libcef:api_hash (int)
at Xilium.CefGlue.CefRuntime.CheckVersionByApiHash () [0x00002] in /Users/jlaase/Documents/dev/xilium.cefglue/CefGlue/CefRuntime.cs:106
at Xilium.CefGlue.CefRuntime.CheckVersion () [0x00002] in /Users/jlaase/Documents/dev/xilium.cefglue/CefGlue/CefRuntime.cs:92
at Xilium.CefGlue.CefRuntime.Load () [0x0000c] in /Users/jlaase/Documents/dev/xilium.cefglue/CefGlue/CefRuntime.cs:81
at System.Threading.Tasks.Task.InnerInvoke () [0x0000f] in /Users/builder/data/lanes/4992/mono-mac-sdk/external/bockbuild/builds/mono-x64/mcs/class/referencesource/mscorlib/system/threading/Tasks/Task.cs:2879
at System.Threading.Tasks.Task.Execute () [0x00010] in /Users/builder/data/lanes/4992/mono-mac-sdk/external/bockbuild/builds/mono-x64/mcs/class/referencesource/mscorlib/system/threading/Tasks/Task.cs:2502
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Users/builder/data/lanes/4992/mono-mac-sdk/external/bockbuild/builds/mono-x64/mcs/class/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:152
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00037] in /Users/builder/data/lanes/4992/mono-mac-sdk/external/bockbuild/builds/mono-x64/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:187
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in /Users/builder/data/lanes/4992/mono-mac-sdk/external/bockbuild/builds/mono-x64/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:156
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in /Users/builder/data/lanes/4992/mono-mac-sdk/external/bockbuild/builds/mono-x64/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:128
at System.Runtime.CompilerServices.TaskAwaiter.GetResult () [0x00000] in /Users/builder/data/lanes/4992/mono-mac-sdk/external/bockbuild/builds/mono-x64/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:113
at Demo.CefGlue.AppDelegate+c__async0.MoveNext () [0x00099] in <6839508fd4284d13b86c5e47bd563ec6>:0
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Users/builder/data/lanes/4992/mono-mac-sdk/external/bockbuild/builds/mono-x64/mcs/class/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:152
at System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.b__6_0 (System.Object state) [0x00000] in /Users/builder/data/lanes/4992/mono-mac-sdk/external/bockbuild/builds/mono-x64/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/AsyncMethodBuilder.cs:1018
at MonoMac.AppKit.AppKitSynchronizationContext+c__AnonStorey0.<>m__0 () [0x00000] in <69849e6b886848f68ef0f56b62fe76aa>:0
at MonoMac.Foundation.NSAsyncActionDispatcher.Apply () [0x00002] in <69849e6b886848f68ef0f56b62fe76aa>:0
at at (wrapper managed-to-native) MonoMac.AppKit.NSApplication:NSApplicationMain (int,string[])
at MonoMac.AppKit.NSApplication.Main (System.String[] args) [0x0003d] in <69849e6b886848f68ef0f56b62fe76aa>:0
at Demo.CefGlue.MainClass.Main (System.String[] args) [0x00006] in <6839508fd4284d13b86c5e47bd563ec6>:0
Thanks,
Josh

Xamarin : condition `array->len == 1' not met SIGABRT error

I have this code which was running fine with Xcode 8 and IOS 10.3.1 till I updated my Xcode to 9 and Visual Studio for Xamarin.
This is the below code which is throwing error and crashing the app during debug:
// Code fetching data from SQLITE [Package name Sqlite-net-pcl]
// Result -> System.Collections.Generic.List
var Result = await _database.GetAsync();
if (Result.Count > 0){
try
{
foreach (var resultObj in Result)
{
Debug.WriteLine("Data {0} ", resultObj.name);
}
}
When I am debugging the code I can see value inside Result and on expression evaluation for resultObj.name I get the desired result. But once the debugger reaches to Debug.WriteLine / If I try to utilize resultObj.name it crashes with the below stack trace :
2017-09-22 15:06:18.549 LoginPage.iOS[415:35914] error: * Assertion at /Users/builder/data/lanes/5024/152b654a/source/xamarin-macios/external/mono/mono/mini/debugger-agent.c:4714, condition `array->len == 1' not met
2017-09-22 15:06:18.550 LoginPage.iOS[415:35914] critical: Stacktrace:
2017-09-22 15:06:18.550 LoginPage.iOS[415:35914] critical: at <unknown> <0xffffffff>
2017-09-22 15:06:18.551 LoginPage.iOS[415:35914] critical: at (wrapper managed-to-native) UIKit.UIApplication.UIApplicationMain (int,string[],intptr,intptr) <0x00007>
2017-09-22 15:06:18.551 LoginPage.iOS[415:35914] critical: at UIKit.UIApplication.Main (string[],intptr,intptr) [0x00005] in /Users/builder/data/lanes/5024/152b654a/source/xamarin-macios/src/UIKit/UIApplication.cs:79
2017-09-22 15:06:18.551 LoginPage.iOS[415:35914] critical: at UIKit.UIApplication.Main (string[],string,string) [0x00038] in /Users/builder/data/lanes/5024/152b654a/source/xamarin-macios/src/UIKit/UIApplication.cs:63
2017-09-22 15:06:18.552 LoginPage.iOS[415:35914] critical: at LoginPage.iOS.Application.Main (string[]) [0x00001] in /Users/beingsrv/Projects/Prescriber360-App/iOS/Main.cs:19
2017-09-22 15:06:18.552 LoginPage.iOS[415:35914] critical: at (wrapper runtime-invoke) object.runtime_invoke_dynamic (intptr,intptr,intptr,intptr) [0x0001e] in <6314851f133e4e74a2e96356deaa0c6c#082A8F72-4318-CDE3-E7A4-8B1E160A93AB>:0
2017-09-22 15:06:18.553 LoginPage.iOS[415:35914] critical:
Native stacktrace:
Also I did tried for loop but facing same issue.
It was working correct till I updated my device as well as Visual Studio for IOS 11.
Any Idea ?

Xamarin forms ios images not visible when deployment target is changed

I'm working on a Xamarin forms project. The problem is in my Xamarin forms ios project when I set my deployment target as 6 all the images are visible when run on simulator, but when I change my deployment target to 9.0, none of the images are visible. I don't know how to resolve this issue.
with deployment target 9.0 i'm getting the below exception.
Could not initialize an instance of the type 'UIKit.UIImage': the native 'initWithContentsOfFile:' method returned nil. It is possible
to ignore this condition by setting
MonoTouch.ObjCRuntime.Class.ThrowOnInitFailure to false.at
Foundation.NSObject.InitializeHandle (System.IntPtr handle,
System.String initSelector) [0x00094] in
/Users/builder/data/lanes/3969/44931ae8/source/xamarin-macios/src/Foundation/NSObject2.cs:465
at UIKit.UIImage..ctor (System.String filename) [0x0002e] in
/Users/builder/data/lanes/3969/44931ae8/source/xamarin-macios/src/build/ios/native/UIKit/UIImage.g.cs:95
at
Xamarin.Forms.Platform.iOS.ToolbarItemExtensions+SecondaryToolbarItem.UpdateIcon
() [0x00000] in
C:\BuildAgent2\work\aad494dc9bc9783\Xamarin.Forms.Platform.iOS\Extensions\ToolbarItemExtensions.cs:142
at
Xamarin.Forms.Platform.iOS.ToolbarItemExtensions+SecondaryToolbarItem..ctor
(Xamarin.Forms.ToolbarItem item) [0x00018] in
C:\BuildAgent2\work\aad494dc9bc9783\Xamarin.Forms.Platform.iOS\Extensions\ToolbarItemExtensions.cs:113
at Xamarin.Forms.Platform.iOS.ToolbarItemExtensions.ToUIBarButtonItem
(Xamarin.Forms.ToolbarItem item, System.Boolean forceName) [0x00000]
in
C:\BuildAgent2\work\aad494dc9bc9783\Xamarin.Forms.Platform.iOS\Extensions\ToolbarItemExtensions.cs:28
at
Xamarin.Forms.Platform.iOS.NavigationRenderer+ParentingViewController.UpdateToolbarItems
() [0x0008f] in
C:\BuildAgent2\work\aad494dc9bc9783\Xamarin.Forms.Platform.iOS\Renderers\NavigationRenderer.cs:935
at
Xamarin.Forms.Platform.iOS.NavigationRenderer+ParentingViewController.ViewDidLoad
() [0x00044] in
C:\BuildAgent2\work\aad494dc9bc9783\Xamarin.Forms.Platform.iOS\Renderers\NavigationRenderer.cs:847
at (wrapper managed-to-native)
ObjCRuntime.Messaging:IntPtr_objc_msgSendSuper (intptr,intptr) at
UIKit.UIViewController.get_View () [0x00030] in
/Users/builder/data/lanes/3969/44931ae8/source/xamarin-macios/src/build/ios/native/UIKit/UIViewController.g.cs:2716
at
Xamarin.Forms.Platform.iOS.NavigationRenderer.CreateViewControllerForPage
(Xamarin.Forms.Page page) [0x000ee] in
C:\BuildAgent2\work\aad494dc9bc9783\Xamarin.Forms.Platform.iOS\Renderers\NavigationRenderer.cs:401
at
Xamarin.Forms.Platform.iOS.NavigationRenderer+<OnPushAsync>d__44.MoveNext
() [0x0000a] in
C:\BuildAgent2\work\aad494dc9bc9783\Xamarin.Forms.Platform.iOS\Renderers\NavigationRenderer.cs:354
--- End of stack trace from previous location where exception was thrown --- at
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw ()
[0x0000c] in
/Users/builder/data/lanes/3969/44931ae8/source/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:143
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess
(System.Threading.Tasks.Task task) [0x00047] in
/Users/builder/data/lanes/3969/44931ae8/source/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:187
at
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification
(System.Threading.Tasks.Task task) [0x0002e] in
/Users/builder/data/lanes/3969/44931ae8/source/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:156
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd
(System.Threading.Tasks.Task task) [0x0000b] in
/Users/builder/data/lanes/3969/44931ae8/source/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:128
at System.Runtime.CompilerServices.TaskAwaiter 1[TResult].GetResult ()
[0x00000] in
/Users/builder/data/lanes/3969/44931ae8/source/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:357
at Xamarin.Forms.NavigationPage+<PushAsyncInner>d__90.MoveNext ()
[0x0009a] in
C:\BuildAgent2\work\aad494dc9bc9783\Xamarin.Forms.Core\NavigationPage.cs:358

CrittercismIOS conflict with MvvmCross

I'm integrating crash reporting via CrittercismIOS and i have used component on Xamarin Component store
https://components.xamarin.com/view/crittercism
but app crash with error reported.
2015-11-25 10:49:50.621 MyApp[40227:2065265] critical: Stacktrace:
2015-11-25 10:49:50.621 MyApp[40227:2065265] critical: at <unknown> <0xffffffff>
2015-11-25 10:49:50.621 MyApp[40227:2065265] critical: at System.Reflection.MonoCMethod.InternalInvoke (object,object[]) [0x00016] in /Users/builder/data/lanes/2356/9ce9e8b9/source/maccore/_build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/corlib/System.Reflection/MonoMethod.cs:650
2015-11-25 10:49:50.621 MyApp[40227:2065265] critical: at System.RuntimeType.CreateInstanceMono (bool) [0x000ca] in /Users/builder/data/lanes/2356/9ce9e8b9/source/maccore/_build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/corlib/ReferenceSources/RuntimeType.cs:113
2015-11-25 10:49:50.622 MyApp[40227:2065265] critical: at System.RuntimeType.CreateInstanceSlow (bool,bool,bool,System.Threading.StackCrawlMark&) [0x0001a] in /Users/builder/data/lanes/2356/9ce9e8b9/source/maccore/_build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/corlib/ReferenceSources/RuntimeType.cs:87
2015-11-25 10:49:50.622 MyApp[40227:2065265] critical: at System.RuntimeType.CreateInstanceDefaultCtor (bool,bool,bool,System.Threading.StackCrawlMark&) [0x0002a] in /Users/builder/data/lanes/2356/9ce9e8b9/source/maccore/_build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/external/referencesource/mscorlib/system/rttype.cs:5734
2015-11-25 10:49:50.622 MyApp[40227:2065265] critical: at System.Activator.CreateInstance (System.Type,bool) [0x00040] in /Users/builder/data/lanes/2356/9ce9e8b9/source/maccore/_build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/external/referencesource/mscorlib/system/activator.cs:214
2015-11-25 10:49:50.622 MyApp[40227:2065265] critical: at System.Activator.CreateInstance (System.Type) [0x00000] in /Users/builder/data/lanes/2356/9ce9e8b9/source/maccore/_build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/external/referencesource/mscorlib/system/activator.cs:147
2015-11-25 10:49:50.622 MyApp[40227:2065265] critical: at Cirrious.MvvmCross.Touch.Views.MvxTouchViewsContainer.CreateViewOfType (System.Type,Cirrious.MvvmCross.ViewModels.MvxViewModelRequest) <IL 0x00077, 0x002fb>
2015-11-25 10:49:50.622 MyApp[40227:2065265] critical: at Cirrious.MvvmCross.Touch.Views.MvxTouchViewsContainer.CreateView (Cirrious.MvvmCross.ViewModels.MvxViewModelRequest) <IL 0x0003e, 0x0018f>
2015-11-25 10:49:50.623 MyApp[40227:2065265] critical: at Cirrious.MvvmCross.Touch.Views.MvxCanCreateTouchViewExtensionMethods.CreateViewControllerFor (Cirrious.MvvmCross.Touch.Views.IMvxCanCreateTouchView,Cirrious.MvvmCross.ViewModels.MvxViewModelRequest) <IL 0x00007, 0x0004a>
2015-11-25 10:49:50.623 MyApp[40227:2065265] critical: at Cirrious.MvvmCross.Touch.Views.Presenters.MvxTouchViewPresenter.Show (Cirrious.MvvmCross.ViewModels.MvxViewModelRequest) <IL 0x00003, 0x00037>
2015-11-25 10:49:50.623 MyApp[40227:2065265] critical: at Cirrious.MvvmCross.Touch.Views.MvxTouchViewDispatcher/<>c__DisplayClass4.<ShowViewModel>b__3 () <IL 0x00028, 0x00090>
2015-11-25 10:49:50.623 MyApp[40227:2065265] critical: at Cirrious.MvvmCross.Touch.Views.MvxTouchUIThreadDispatcher.RequestMainThreadAction (System.Action) <IL 0x00028, 0x000e8>
2015-11-25 10:49:50.623 MyApp[40227:2065265] critical: at Cirrious.MvvmCross.Touch.Views.MvxTouchViewDispatcher.ShowViewModel (Cirrious.MvvmCross.ViewModels.MvxViewModelRequest) <IL 0x00024, 0x0015b>
2015-11-25 10:49:50.623 MyApp[40227:2065265] critical: at Cirrious.MvvmCross.ViewModels.MvxNavigatingObject.ShowViewModelImpl (System.Type,Cirrious.MvvmCross.ViewModels.IMvxBundle,Cirrious.MvvmCross.ViewModels.IMvxBundle,Cirrious.MvvmCross.ViewModels.MvxRequestedBy) <IL 0x00030, 0x00145>
2015-11-25 10:49:50.623 MyApp[40227:2065265] critical: at Cirrious.MvvmCross.ViewModels.MvxNavigatingObject.ShowViewModel (System.Type,Cirrious.MvvmCross.ViewModels.IMvxBundle,Cirrious.MvvmCross.ViewModels.IMvxBundle,Cirrious.MvvmCross.ViewModels.MvxRequestedBy) <IL 0x00006, 0x0004f>
2015-11-25 10:49:50.624 MyApp[40227:2065265] critical: at Cirrious.MvvmCross.ViewModels.MvxNavigatingObject.ShowViewModel<T_REF> (Cirrious.MvvmCross.ViewModels.IMvxBundle,Cirrious.MvvmCross.ViewModels.IMvxBundle,Cirrious.MvvmCross.ViewModels.MvxRequestedBy) <IL 0x0000e, 0x0005b>
MvvmCross version is 3.5.1 and Crittercism 2.4 on Xamarin Component Store.
If i remove in FinishedLaunching this code
CrittercismIOS.Crittercism.Init("00ac4950703d418c9cef9b7818cc307300444503");
App works fine (it works fine also with Xamarin.Insight, but it is not possible to use both dll).
Version 2.5 resolve this issue
https://components.xamarin.com/view/crittercism
For MvvmCross, you should put the Crittercism initialization in your Setup.cs class.
public Setup(Context applicationContext) : base(applicationContext)
{
Crittercism.Init (applicationContext, "YOUR APP ID GOES HERE");
}
The setup instructions provided in the Crittercism Xamarin documentation make the assumption that you're putting the code in a class that inherits from an Android Activity. With MvvmCross, this does not apply. You need to put the initialization in your Setup method instead as shown above.

Resources