Visual Studio Mac Installer fails to load - macos

I am trying to update my visual studio on my Mac to the latest version however my installer keeps failing. I tried deleting visual studio and then trying again but it won't work. Do I have to completely delete all visual studio files? How do I do that on a Mac (I'm usually a windows user and doing this for Xamarin usage)? Here is the error output:
Initial task was failed
Message: Object reference not set to an instance of an object
System.NullReferenceException
at MacInstaller.Core.Installer.AndroidSoftwareItem+<>c__DisplayClass53_0.b__0 (MacInstaller.Core.AvdInfo avd) [0x00000] in /Users/vsts/agent/2.158.0/work/1/installer/MacInstaller.Universal/Core/Installer/SoftwareItems/AndroidSDK/AndroidSoftwareItem.cs:190
at System.Linq.Enumerable+WhereListIterator1[TSource].ToList () [0x00017] in /Library/Frameworks/Xamarin.Mac.framework/Versions/5.14.0.114/src/Xamarin.Mac/external/corefx/src/System.Linq/src/System/Linq/Where.cs:391
at System.Linq.Enumerable.ToList[TSource] (System.Collections.Generic.IEnumerable1[T] source) [0x0000e] in /Library/Frameworks/Xamarin.Mac.framework/Versions/5.14.0.114/src/Xamarin.Mac/external/corefx/src/System.Linq/src/System/Linq/ToCollection.cs:30
at MacInstaller.Core.Installer.AndroidSoftwareItem.CreateSystemImageSet (System.String platform, System.Collections.Generic.List1[T] avds, MacInstaller.Core.AndroidSystemImageOptions asio, System.Collections.Generic.IList1[T] components) [0x00035] in /Users/vsts/agent/2.158.0/work/1/installer/MacInstaller.Universal/Core/Installer/SoftwareItems/AndroidSDK/AndroidSoftwareItem.cs:190
at MacInstaller.Core.Installer.AndroidSoftwareItem.InitInstallationComponents () [0x0012f] in /Users/vsts/agent/2.158.0/work/1/installer/MacInstaller.Universal/Core/Installer/SoftwareItems/AndroidSDK/AndroidSoftwareItem.cs:139
at MacInstaller.Core.Installer.AndroidSoftwareItem.InitInstaller () [0x00095] in /Users/vsts/agent/2.158.0/work/1/installer/MacInstaller.Universal/Core/Installer/SoftwareItems/AndroidSDK/AndroidSoftwareItem.cs:112
at MacInstaller.Core.Installer.AndroidSoftwareItem.NeedsUpdate () [0x00024] in /Users/vsts/agent/2.158.0/work/1/installer/MacInstaller.Universal/Core/Installer/SoftwareItems/AndroidSDK/AndroidSoftwareItem.cs:275
at MacInstaller.Core.TasksManager.DetectComponent (MacInstaller.Core.Installer.ISoftwareItem softwareItem) [0x0001f] in /Users/vsts/agent/2.158.0/work/1/installer/MacInstaller.Universal/Core/TasksManager.cs:139
at MacInstaller.Core.TasksManager.DetectComponents () [0x00073] in /Users/vsts/agent/2.158.0/work/1/installer/MacInstaller.Universal/Core/TasksManager.cs:118
at MacInstaller.Core.TasksManager+<>c__DisplayClass13_0.b__0 () [0x00074] in /Users/vsts/agent/2.158.0/work/1/installer/MacInstaller.Universal/Core/TasksManager.cs:72
at System.Threading.Tasks.Task.InnerInvoke () [0x0000f] in /Library/Frameworks/Xamarin.Mac.framework/Versions/5.14.0.114/src/Xamarin.Mac/external/corert/src/System.Private.CoreLib/src/System/Threading/Tasks/Task.cs:2476
at System.Threading.Tasks.Task.Execute () [0x00000] in /Library/Frameworks/Xamarin.Mac.framework/Versions/5.14.0.114/src/Xamarin.Mac/external/corert/src/System.Private.CoreLib/src/System/Threading/Tasks/Task.cs:2319
--- End of stack trace from previous location where exception was thrown ---
at MacInstaller.Core.TasksManager.StartAsync () [0x00068] in /Users/vsts/agent/2.158.0/work/1/installer/MacInstaller.Universal/Core/TasksManager.cs:52

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 Studio community treats handled exception as unhandled exception

I have this problem where I get unhandled exception crash on my Xamarin Android app. I'm trying to login user into parse.com using user session token. The statements are put inside try-catch block to catch exceptions. But catch block fails to catch "Invalid session token" error from parse.com and app crashes. Catch block works fine if I manually tamper sessionToken.
Here's what I am doing
try {
await ParseUser.BecomeAsync(sessionToken);
...
} catch (Exception e){
//log exception
}
when there is invalid session token error, above code crashes saying "unhandled exception...." even though it was put inside try block.
following code works. (manually tampering token)
try {
await ParseUser.BecomeAsync(sessionToken + "test");
...
} catch (Exception e){
//log exception
}
Parse component from Xamarin Component store
What am I missing?
Also, same code works just fine with Xamarin.iOS.
EDIT Adding StackTrace
at Parse.Internal.ParseCommandRunner+<>c__DisplayClass2.<RunCommandAsync>b__1 (System.Threading.Tasks.Task`1[TResult] t) [0x000eb] in <5d1c0c2b96a7483d85e5c63b3e156125>:0
at Parse.Internal.InternalExtensions+<>c__DisplayClass1`2[TIn,TResult].<OnSuccess>b__0 (System.Threading.Tasks.Task t) [0x00000] in <5d1c0c2b96a7483d85e5c63b3e156125>:0
at Parse.Internal.InternalExtensions+<>c__DisplayClass7`1[TResult].<OnSuccess>b__6 (System.Threading.Tasks.Task t) [0x0006f] in <5d1c0c2b96a7483d85e5c63b3e156125>:0
at System.Threading.Tasks.ContinuationResultTaskFromTask`1[TResult].InnerInvoke () [0x00024] in <3fd174ff54b146228c505f23cf75ce71>:0
at System.Threading.Tasks.Task.Execute () [0x00010] in <3fd174ff54b146228c505f23cf75ce71>:0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <3fd174ff54b146228c505f23cf75ce71>:0
at Parse.Internal.InternalExtensions+<>c__DisplayClass7`1[TResult].<OnSuccess>b__6 (System.Threading.Tasks.Task t) [0x00033] in <5d1c0c2b96a7483d85e5c63b3e156125>:0
at System.Threading.Tasks.ContinuationResultTaskFromTask`1[TResult].InnerInvoke () [0x00024] in <3fd174ff54b146228c505f23cf75ce71>:0
at System.Threading.Tasks.Task.Execute () [0x00010] in <3fd174ff54b146228c505f23cf75ce71>:0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <3fd174ff54b146228c505f23cf75ce71>:0
at Parse.Internal.InternalExtensions+<>c__DisplayClass7`1[TResult].<OnSuccess>b__6 (System.Threading.Tasks.Task t) [0x00033] in <5d1c0c2b96a7483d85e5c63b3e156125>:0
at System.Threading.Tasks.ContinuationResultTaskFromTask`1[TResult].InnerInvoke () [0x00024] in <3fd174ff54b146228c505f23cf75ce71>:0
at System.Threading.Tasks.Task.Execute () [0x00010] in <3fd174ff54b146228c505f23cf75ce71>:0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <3fd174ff54b146228c505f23cf75ce71>:0
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <3fd174ff54b146228c505f23cf75ce71>:0
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <3fd174ff54b146228c505f23cf75ce71>:0
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <3fd174ff54b146228c505f23cf75ce71>:0
at System.Runtime.CompilerServices.TaskAwaiter`1[TResult].GetResult () [0x00000] in <3fd174ff54b146228c505f23cf75ce71>:0
at Hyphen_App.Droid.SplashActivity+<setCurrentUser>d__4.MoveNext () [0x00035] in /Chethan Shetty/GIT/android-parent/Hyphen_App.Droid/Splash/SplashActivity.cs:112
EDIT 1 After changing setCurrentUser to following, I am able to catch the exception but after 3-4 seconds app crashes by itself giving " System.AggregateException"
void setCurrentUser(string sessionToken,Action<bool> callback){
try {
ParseUser.BecomeAsync(sessionToken).Wait();
callback(true);
}catch(AggregateException e){
e.Handle( x => { return true; });
callback(false);
}
Like you said in the comments you were calling the async method in your OnCreate without awaiting it.
It can cause the Exception not to be caught, if the somewhere in the async stack a task is not awaited.
I hope it helped you resolve the issue.
Update
Sorry for not expressing me clearly. Your code must look something like that:
protected override async void OnCreate(Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);
await this.SetCurrentUser();
}
private async Task<bool> SetCurrentUser(string sessionToken)
{
try {
await ParseUser.BecomeAsync(sessionToken);
} catch (Exception e) {
return false;
}
}
to use the await keyword was what i was referring to when saying 'awaiting'.
With the async / await keywords in C#, callbacks are rarely used in asynchronous scenarios anymore. There is a short introduction over at microsoft docs

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

Java.Lang.IllegalStateException while using FormsAppCompatActivity in Xamarin Android

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.

Resources