Xamarin.Forms.GoogleMaps failed to start on IOS, breaks in UpdateIsShowingUser - c#

[Xamarin.Forms.GoogleMaps][1] is failing when deploying to IOS (in my case iPhone phisical device).
The app is trying to start but then crashes to the OS. Visual Studio does not catch the break point.
In the output window I get this:
Loaded assembly:
/private/var/mobile/Containers/Data/Application/BE8F87C7-8FB5-4F76-9674-03D160780B77/Documents/XFGoogleMapSampleiOS.content/Xamarin.Forms.Xaml.dll
[External] Loaded assembly:
/private/var/containers/Bundle/Application/F4979BA1-4F02-476D-BB93-7A84EE654A10/XFGoogleMapSampleiOS.app/System.Xml.dll
[External] Thread started: #4 Thread started: #5 Thread started: #6 Thread started: #7 Resolved pending breakpoint at 'BasicMapPage.xaml.cs:139,1'
to void XFGoogleMapSample.BasicMapPage.<.ctor>b__0_15 (object sender,
Xamarin.Forms.GoogleMaps.CameraChangedEventArgs args) [0x00008].
Loaded assembly:
/private/var/containers/Bundle/Application/F4979BA1-4F02-476D-BB93-7A84EE654A10/XFGoogleMapSampleiOS.app/System.Net.Http.dll
[External] Loaded assembly:
/private/var/containers/Bundle/Application/F4979BA1-4F02-476D-BB93-7A84EE654A10/XFGoogleMapSampleiOS.app/System.Drawing.Common.dll
[External] [0:] An error occurred: 'Object reference not set to an
instance of an object.'. Callstack: ' at
Xamarin.Forms.GoogleMaps.iOS.MapRenderer.UpdateIsShowingUser
(System.Nullable1[T] initialMyLocationButtonEnabled) <0x119727660 + 0x0007a> in <cae073484d4d4db5b36708f421f24080>:0 at Xamarin.Forms.GoogleMaps.iOS.MapRenderer.OnElementChanged (Xamarin.Forms.Platform.iOS.ElementChangedEventArgs1[TElement] e)
<0x118649e28 + 0x002d0> in :0 at
Xamarin.Forms.Platform.iOS.VisualElementRenderer1[TElement].SetElement (TElement element) [0x00134] in D:\a\1\s\Xamarin.Forms.Platform.iOS\VisualElementRenderer.cs:193 at Xamarin.Forms.Platform.iOS.VisualElementRenderer1[TElement].Xamarin.Forms.Platform.iOS.IVisualElementRenderer.SetElement
(Xamarin.Forms.VisualElement element) [0x00000] in
D:\a\1\s\Xamarin.Forms.Platform.iOS\VisualElementRenderer.cs:141 at
Xamarin.Forms.Platform.iOS.Platform.CreateRenderer
(Xamarin.Forms.VisualElement element) [0x00014] in
D:\a\1\s\Xamarin.Forms.Platform.iOS\Platform.cs:199 at
Xamarin.Forms.Platform.iOS.VisualElementPackager.OnChildAdded
(Xamarin.Forms.VisualElement view) [0x0004f] in
D:\a\1\s\Xamarin.Forms.Platform.iOS\VisualElementPackager.cs:79 at
Xamarin.Forms.Platform.iOS.VisualElementPackager.Load () [0x0001e] in
D:\a\1\s\Xamarin.Forms.Platform.iOS\VisualElementPackager.cs:46 at
Xamarin.Forms.Platform.iOS.VisualElementRenderer1[TElement].SetElement (TElement element) [0x000f0] in D:\a\1\s\Xamarin.Forms.Platform.iOS\VisualElementRenderer.cs:180 at Xamarin.Forms.Platform.iOS.VisualElementRenderer1[TElement].Xamarin.Forms.Platform.iOS.IVisualElementRenderer.SetElement
(Xamarin.Forms.VisualElement element) [0x00000] in
D:\a\1\s\Xamarin.Forms.Platform.iOS\VisualElementRenderer.cs:141 at
Xamarin.Forms.Platform.iOS.Platform.CreateRenderer
(Xamarin.Forms.VisualElement element) [0x00014] in
D:\a\1\s\Xamarin.Forms.Platform.iOS\Platform.cs:199 at
Xamarin.Forms.Platform.iOS.VisualElementPackager.OnChildAdded
(Xamarin.Forms.VisualElement view) [0x0004f] in
D:\a\1\s\Xamarin.Forms.Platform.iOS\VisualElementPackager.cs:79 at
Xamarin.Forms.Platform.iOS.VisualElementPackager.Load () [0x0001e] in
D:\a\1\s\Xamarin.Forms.Platform.iOS\VisualElementPackager.cs:46 at
Xamarin.Forms.Platform.iOS.PageRenderer.ViewDidLoad () [0x00086] in
D:\a\1\s\Xamarin.Forms.Platform.iOS\Renderers\PageRenderer.cs:123
at (wrapper managed-to-native)
ObjCRuntime.Messaging.IntPtr_objc_msgSendSuper(intptr,intptr) at
UIKit.UIViewController.get_View () [0x0002a] in
/Library/Frameworks/Xamarin.iOS.framework/Versions/14.2.0.12/src/Xamarin.iOS/UIKit/UIViewController.g.cs:3267
at Xamarin.Forms.Platform.iOS.PageRenderer.get_NativeView () [0x00000]
in D:\a\1\s\Xamarin.Forms.Platform.iOS\Renderers\PageRenderer.cs:41
at Xamarin.Forms.Platform.iOS.PageRenderer.SetElement
(Xamarin.Forms.VisualElement element) [0x0004f] in
D:\a\1\s\Xamarin.Forms.Platform.iOS\Renderers\PageRenderer.cs:56 at
Xamarin.Forms.Platform.iOS.Platform.CreateRenderer
(Xamarin.Forms.VisualElement element) [0x00014] in
D:\a\1\s\Xamarin.Forms.Platform.iOS\Platform.cs:199 at
Xamarin.Forms.Platform.iOS.NavigationRenderer.CreateViewControllerForPage
(Xamarin.Forms.Page page) [0x00008] in
D:\a\1\s\Xamarin.Forms.Platform.iOS\Renderers\NavigationRenderer.cs:357
at Xamarin.Forms.Platform.iOS.NavigationRenderer.OnPushAsync
(Xamarin.Forms.Page page, System.Boolean animated) [0x0001d] in
D:\a\1\s\Xamarin.Forms.Platform.iOS\Renderers\NavigationRenderer.cs:344
at Xamarin.Forms.Platform.iOS.NavigationRenderer.b__42_0
(Xamarin.Forms.Page p) [0x00024] in
D:\a\1\s\Xamarin.Forms.Platform.iOS\Renderers\NavigationRenderer.cs:228
at
System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.b__7_0
(System.Object state) [0x00000] in
/Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/AsyncMethodBuilder.cs:1021
at (wrapper delegate-invoke) .invoke_void_object(object) at
Foundation.NSAsyncSynchronizationContextDispatcher.Apply () [0x00000]
in
/Library/Frameworks/Xamarin.iOS.framework/Versions/14.2.0.12/src/Xamarin.iOS/Foundation/NSAction.cs:178
--- End of stack trace from previous location where exception was thrown ---
at (wrapper managed-to-native)
UIKit.UIApplication.UIApplicationMain(int,string[],intptr,intptr) at
UIKit.UIApplication.Main (System.String[] args, System.IntPtr
principal, System.IntPtr delegate) [0x00005] in
/Library/Frameworks/Xamarin.iOS.framework/Versions/14.2.0.12/src/Xamarin.iOS/UIKit/UIApplication.cs:86
at UIKit.UIApplication.Main (System.String[] args, System.String
principalClassName, System.String delegateClassName) [0x0000e] in
/Library/Frameworks/Xamarin.iOS.framework/Versions/14.2.0.12/src/Xamarin.iOS/UIKit/UIApplication.cs:65
at XFGoogleMapSample.iOS.Application.Main (System.String[] args)
[0x00001] in
C:\Projects\Xamarin.Forms.GoogleMaps-master\XFGoogleMapSample\iOS\Main.cs:17
at (wrapper managed-to-native)
System.Reflection.RuntimeMethodInfo.InternalInvoke(System.Reflection.RuntimeMethodInfo,object,object[],System.Exception&)
at System.Reflection.RuntimeMethodInfo.Invoke (System.Object obj,
System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder
binder, System.Object[] parameters, System.Globalization.CultureInfo
culture) [0x0006a] in
/Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/mcs/class/corlib/System.Reflection/RuntimeMethodInfo.cs:395
' The app has been terminated.
First, I tried on my local project. After, I decided to get the source code of the googlemaps libray from git hub and debug it.
It breaks in the MapRenderer.cs
private void UpdateIsShowingUser(bool? initialMyLocationButtonEnabled = null)
{
#pragma warning disable 618
((MapView)Control).MyLocationEnabled = ((Map)Element).IsShowingUser;
((MapView)Control).Settings.MyLocationButton = initialMyLocationButtonEnabled ?? ((Map)Element).IsShowingUser;
#pragma warning restore 618
}
Apparently the native Google.Maps.MapView.Settings is null here. I am not sure what exacly am I doing wrong, but the same library works perfect in Andoid version. It only fails in IOS.
I have set up API keys and API on google developer console.
Visual Studio Version 16.7.7
IOS 14.1
Xamarin.iOS 14.2.0.12
I also tried the standard xamarin google maps lirary and it works fine (it just miss many features comparing to Xamarin.Forms.GoogleMaps)
[1]: https://github.com/amay077/Xamarin.Forms.GoogleMaps

Related

Creating a Xamarin Bindings Library for a Custom iOS Control

Xcode version - 11.1
visual studio - 8.3.3
when using the below command -
sharpie bind --output=GCCheckbox --namespace=GCCheckbox --sdk=iphoneos13.1 /Checkbox/Checkbox/Checkbox.h
......
Binding...
System.Exception: Unsupported clang availability platform: 'macCatalyst'
at Sharpie.Bind.Attributes.AvailabilityBaseAttribute+d__7.MoveNext () [0x003aa] in /Users/builder/vsts/_work/2/s/Sharpie.Bind/Attributes/AvailabilityBaseAttribute.cs:203
at System.Linq.Enumerable+SelectManySingleSelectorIterator`2[TSource,TResult].MoveNext () [0x0006f] in <3fb92ec709f44a579da6a23087df403d>:0
at Sharpie.Bind.Massagers.AvailabilityMassager.Massage (ICSharpCode.NRefactory.CSharp.EntityDeclaration entity) [0x00092] in /Users/builder/vsts/_work/2/s/Sharpie.Bind/Massagers/AvailabilityMassager.cs:55
at Sharpie.Bind.Massagers.AvailabilityMassager.VisitMethodDeclaration (ICSharpCode.NRefactory.CSharp.MethodDeclaration methodDeclaration) [0x00000] in /Users/builder/vsts/_work/2/s/Sharpie.Bind/Massagers/AvailabilityMassager.cs:35
at ICSharpCode.NRefactory.CSharp.MethodDeclaration.AcceptVisitor (ICSharpCode.NRefactory.CSharp.IAstVisitor visitor) [0x00000] in :0
at ICSharpCode.NRefactory.CSharp.DepthFirstAstVisitor.VisitChildren (ICSharpCode.NRefactory.CSharp.AstNode node) [0x00010] in :0
at ICSharpCode.NRefactory.CSharp.DepthFirstAstVisitor.VisitTypeDeclaration (ICSharpCode.NRefactory.CSharp.TypeDeclaration typeDeclaration) [0x00000] in :0
at Sharpie.Bind.Massagers.AvailabilityMassager.VisitTypeDeclaration (ICSharpCode.NRefactory.CSharp.TypeDeclaration typeDeclaration) [0x00006] in /Users/builder/vsts/_work/2/s/Sharpie.Bind/Massagers/AvailabilityMassager.cs:24
at ICSharpCode.NRefactory.CSharp.TypeDeclaration.AcceptVisitor (ICSharpCode.NRefactory.CSharp.IAstVisitor visitor) [0x00000] in :0
at ICSharpCode.NRefactory.CSharp.DepthFirstAstVisitor.VisitChildren (ICSharpCode.NRefactory.CSharp.AstNode node) [0x00010] in :0
at ICSharpCode.NRefactory.CSharp.DepthFirstAstVisitor.VisitSyntaxTree (ICSharpCode.NRefactory.CSharp.SyntaxTree syntaxTree) [0x00000] in :0
at Sharpie.Bind.DocumentSyntaxTree.AcceptVisitor (ICSharpCode.NRefactory.CSharp.IAstVisitor visitor) [0x00015] in /Users/builder/vsts/_work/2/s/Sharpie.Bind/DocumentSyntaxTree.cs:37
at Sharpie.Bind.BindingMassager.Massage (ICSharpCode.NRefactory.CSharp.AstNode astNode, Sharpie.Bind.BindingTarget bindingTarget) [0x00033] in /Users/builder/vsts/_work/2/s/Sharpie.Bind/BindingMassager.cs:136
at Sharpie.Bind.BindingFrontend.Bind (Clang.Ast.Decl decl) [0x0010d] in /Users/builder/vsts/_work/2/s/Sharpie.Bind/BindingFrontend.cs:93
at Sharpie.BindTool.HandleTranslationUnit (Clang.Ast.TranslationUnitDecl decl) [0x0018d] in /Users/builder/vsts/_work/2/s/Sharpie/BindTool.cs:166
at Clang.Driver.HandleTranslationUnit (Clang.Ast.TranslationUnitDecl translationUnit) [0x00000] in /Users/builder/vsts/_work/2/s/Clang/Driver.cs:158
at Clang.Driver.HandleTranslationUnit (System.IntPtr translationUnit) [0x00000] in /Users/builder/vsts/_work/2/s/Clang/Driver.cs:148
at (wrapper managed-to-native) Clang.Driver:RunInternal (Clang.Driver,string[],string,Clang.Frontend.DiagnosticConsumer)
at Clang.Driver.Run (System.String[] inputFiles, System.String[] clangArgs, Clang.Frontend.DiagnosticConsumer diagnosticConsumer) [0x00177] in /Users/builder/vsts/_work/2/s/Clang/Driver.cs:139
at Sharpie.ParseTool.Run () [0x005c8] in /Users/builder/vsts/_work/2/s/Sharpie/ParseTool.cs:581
at Sharpie.BindTool.CoreRun () [0x00001] in /Users/builder/vsts/_work/2/s/Sharpie/BindTool.cs:117
at Sharpie.BindTool.Run () [0x00026] in /Users/builder/vsts/_work/2/s/Sharpie/BindTool.cs:95
Done. Exiting with error code 1.

Xamarin Forms Init crashes after adding FormsMaterial Init

I'm attempting to add Xamarin.Forms Material Visual to my app. I'm following the instructions here and after I add the Forms Material init, I get a crash in the Forms init. Here's the code...
public override bool FinishedLaunching(UIApplication app, NSDictionary options)
{
global::Xamarin.Forms.Forms.Init();
global::Xamarin.Forms.FormsMaterial.Init();
LoadApplication(new App());
return base.FinishedLaunching(app, options);
}
Without global::Xamarin.Forms.FormsMaterial.Init();, everything runs fine. When I add it, global::Xamarin.Forms.Forms.Init(); crashes with an exception "System.Reflection.CustomAttributeFormatException has been thrown" and "Could not find a property with name Priority". How does a line added after another cause an exception on the previous line? Anyone know what's going on?
Here's the stacktrace:
System.Reflection.CustomAttributeFormatException: Could not find a property with name Priority
at at (wrapper managed-to-native) System.MonoCustomAttrs.GetCustomAttributesInternal(System.Reflection.ICustomAttributeProvider,System.Type,bool)
at System.MonoCustomAttrs.GetCustomAttributesBase (System.Reflection.ICustomAttributeProvider obj, System.Type attributeType, System.Boolean inheritedOnly) [0x00013] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/external/mono/mcs/class/corlib/System/MonoCustomAttrs.cs:128
at System.MonoCustomAttrs.GetCustomAttributes (System.Reflection.ICustomAttributeProvider obj, System.Type attributeType, System.Boolean inherit) [0x00037] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/external/mono/mcs/class/corlib/System/MonoCustomAttrs.cs:163
at System.Reflection.RuntimeAssembly.GetCustomAttributes (System.Type attributeType, System.Boolean inherit) [0x00000] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/external/mono/mcs/class/corlib/System.Reflection/RuntimeAssembly.cs:520
at Xamarin.Forms.Internals.Registrar.RegisterAll (System.Type[] attrTypes, Xamarin.Forms.ActivationFlags flags) [0x000a1] in D:\a\1\s\Xamarin.Forms.Core\Registrar.cs:331
at Xamarin.Forms.Internals.Registrar.RegisterAll (System.Type[] attrTypes) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\Registrar.cs:298
at Xamarin.Forms.Forms.Init () [0x0009d] in <f0489d3941b24a20a5b9223b572ec7c0>:0
at OSSM.iOS.AppDelegate.FinishedLaunching (UIKit.UIApplication app, Foundation.NSDictionary options) [0x00001] in /Users/rob5408/Work/OSSM/OSSM.iOS/AppDelegate.cs:25
at at (wrapper managed-to-native) UIKit.UIApplication.UIApplicationMain(int,string[],intptr,intptr)
at UIKit.UIApplication.Main (System.String[] args, System.IntPtr principal, System.IntPtr delegate) [0x00005] in /Library/Frameworks/Xamarin.iOS.framework/Versions/13.6.0.12/src/Xamarin.iOS/UIKit/UIApplication.cs:86
at UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x0000e] in /Library/Frameworks/Xamarin.iOS.framework/Versions/13.6.0.12/src/Xamarin.iOS/UIKit/UIApplication.cs:65
at OSSM.iOS.Application.Main (System.String[] args) [0x00001] in /Users/rob5408/Work/OSSM/OSSM.iOS/Main.cs:18

MvvmCross Failed to construct and initialize ViewModel for type

I am trying to create a mobile application using MvvmCross v.4.4.0.
Application works correct. But if collapse application and lock the phone, and then unlock and press "Overview" android button application crash (only on the Xiaomi phone).
I think android kills activity and then unsuccessfully trying to recreate it.
Could you, please explain me, what I do wrong? How to fix it?
Stacktrace:
Android.Runtime.RaiseThrowableEventArgs MvvmCross.Platform.Exceptions.MvxException: Failed to construct and initialize ViewModel for type Test.Core.ViewModels.MainMenuViewModel from locator MvxDefaultViewModelLocator - check InnerException for more information ---> MvvmCross.Platform.Exceptions.MvxException: Problem creating viewModel of type MainMenuViewModel ---> MvvmCross.Platform.Exceptions.MvxIoCResolveException: Failed to construct MainMenuViewModel ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> Java.Lang.LinkageError: no static method "Landroid/text/Html;.fromHtml(Ljava/lang/String;I)Landroid/text/Spanned;" at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw ()
[0x0000c] in <89dd20b27a0b473a848558c84f1f086a>:0 at Java.Interop.JniEnvironment+StaticMethods.GetStaticMethodID (Java.Interop.JniObjectReference type, System.String name, System.String signature)
[0x00068] in :0 at Java.Interop.JniType.GetStaticMethod (System.String name, System.String signature)
[0x0000d] in :0 at Java.Interop.JniPeerMembers+JniStaticMethods.GetMethodInfo (System.String encodedMember)
[0x0003c] in :0 at Java.Interop.JniPeerMembers+JniStaticMethods.InvokeObjectMethod (System.String encodedMember, Java.Interop.JniArgumentValue* parameters)
[0x00001] in :0 at Android.Text.Html.FromHtml (System.String source, Android.Text.FromHtmlOptions flags)
[0x0003b] in :0 at Test.Droid.Providers.DialogProvider.ShowSnackbar () [0x00017] in <0fa1f44ee2f748fe816e790571c2153b>:0 at Test.Core.ViewModels.BaseViewModel..ctor ()
[0x0006d] in :0 at Test.Core.ViewModels.MainMenuViewModel..ctor (Test.Core.Managers.IExceptionManager exceptionManager)
[0x0000b] in :0 at (wrapper managed-to-native) System.Reflection.MonoCMethod:InternalInvoke (System.Reflection.MonoCMethod,object,object[],System.Exception&) at System.Reflection.MonoCMethod.InternalInvoke (System.Object obj, System.Object[] parameters)
[0x00002] in <89dd20b27a0b473a848558c84f1f086a>:0 --- End of inner exception stack trace --- at System.Reflection.MonoCMethod.InternalInvoke (System.Object obj, System.Object[] parameters)
[0x0001c] in <89dd20b27a0b473a848558c84f1f086a>:0 at System.Reflection.MonoCMethod.DoInvoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture)
[0x00089] in <89dd20b27a0b473a848558c84f1f086a>:0 at System.Reflection.MonoCMethod.Invoke (System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture)
[0x00000] in <89dd20b27a0b473a848558c84f1f086a>:0 at System.Reflection.ConstructorInfo.Invoke (System.Object[] parameters)
[0x00000] in <89dd20b27a0b473a848558c84f1f086a>:0 at MvvmCross.Platform.IoC.MvxSimpleIoCContainer.IoCConstruct (System.Type type)
[0x0003a] in <4ddde23419c5494288c799fcdbb0f189>:0 --- End of inner exception stack trace --- at MvvmCross.Platform.IoC.MvxSimpleIoCContainer.IoCConstruct (System.Type type)
[0x0005b] in <4ddde23419c5494288c799fcdbb0f189>:0 at MvvmCross.Platform.Mvx.IocConstruct (System.Type t)
[0x00005] in <4ddde23419c5494288c799fcdbb0f189>:0 at MvvmCross.Core.ViewModels.MvxDefaultViewModelLocator.Load (System.Type viewModelType, MvvmCross.Core.ViewModels.IMvxBundle parameterValues, MvvmCross.Core.ViewModels.IMvxBundle savedState)
[0x00000] in <69bce0378e8e413982d3b552d7e387a8>:0 --- End of inner exception stack trace --- at MvvmCross.Core.ViewModels.MvxDefaultViewModelLocator.Load (System.Type viewModelType, MvvmCross.Core.ViewModels.IMvxBundle parameterValues, MvvmCross.Core.ViewModels.IMvxBundle savedState)
[0x00027] in <69bce0378e8e413982d3b552d7e387a8>:0 at MvvmCross.Core.ViewModels.MvxViewModelLoader.LoadViewModel (MvvmCross.Core.ViewModels.MvxViewModelRequest request, MvvmCross.Core.ViewModels.IMvxBundle savedState, MvvmCross.Core.ViewModels.IMvxViewModelLocator viewModelLocator)
[0x00015] in <69bce0378e8e413982d3b552d7e387a8>:0 --- End of inner exception stack trace --- at MvvmCross.Core.ViewModels.MvxViewModelLoader.LoadViewModel (MvvmCross.Core.ViewModels.MvxViewModelRequest request, MvvmCross.Core.ViewModels.IMvxBundle savedState, MvvmCross.Core.ViewModels.IMvxViewModelLocator viewModelLocator)
[0x00046] in <69bce0378e8e413982d3b552d7e387a8>:0 at MvvmCross.Core.ViewModels.MvxViewModelLoader.LoadViewModel (MvvmCross.Core.ViewModels.MvxViewModelRequest request, MvvmCross.Core.ViewModels.IMvxBundle savedState)
[0x00020] in <69bce0378e8e413982d3b552d7e387a8>:0 at MvvmCross.Droid.Views.MvxAndroidViewsContainer.ViewModelFromRequest (MvvmCross.Core.ViewModels.MvxViewModelRequest viewModelRequest, MvvmCross.Core.ViewModels.IMvxBundle savedState)
[0x00005] in :0 at MvvmCross.Droid.Views.MvxAndroidViewsContainer.CreateViewModelFromIntent (Android.Content.Intent intent, MvvmCross.Core.ViewModels.IMvxBundle savedState)
[0x00027] in :0 at MvvmCross.Droid.Views.MvxAndroidViewsContainer.Load (Android.Content.Intent intent, MvvmCross.Core.ViewModels.IMvxBundle savedState, System.Type viewModelTypeHint)
[0x00089] in :0 at MvvmCross.Droid.Views.MvxActivityViewExtensions.LoadViewModel (MvvmCross.Droid.Views.IMvxAndroidView androidView, MvvmCross.Core.ViewModels.IMvxBundle savedState)
[0x0006a] in :0 at MvvmCross.Droid.Views.MvxActivityViewExtensions+<>c__DisplayClass1_0.b__1 ()
[0x0000a] in :0 at MvvmCross.Core.Views.MvxViewExtensionMethods.OnViewCreate (MvvmCross.Core.Views.IMvxView view, System.Func`1[TResult] viewModelLoader)
[0x00012] in <69bce0378e8e413982d3b552d7e387a8>:0 at MvvmCross.Droid.Views.MvxActivityViewExtensions.OnViewCreate (MvvmCross.Droid.Views.IMvxAndroidView androidView, Android.OS.Bundle bundle)
[0x00062] in :0 at MvvmCross.Droid.Views.MvxActivityAdapter.EventSourceOnCreateCalled (System.Object sender, MvvmCross.Platform.Core.MvxValueEventArgs`1[T] eventArgs)
[0x0000c] in :0 at (wrapper delegate-invoke) System.EventHandler`1[MvvmCross.Platform.Core.MvxValueEventArgs`1[Android.OS.Bundle]]:invoke_void_object_TEventArgs (object,MvvmCross.Platform.Core.MvxValueEventArgs`1) at MvvmCross.Platform.Core.MvxDelegateExtensionMethods.Raise[T] (System.EventHandler`1[TEventArgs] eventHandler, System.Object sender, T value)
[0x0000b] in <4ddde23419c5494288c799fcdbb0f189>:0 at MvvmCross.Platform.Droid.Views.MvxEventSourceActivity.OnCreate (Android.OS.Bundle bundle)
[0x00014] in <4230cf00b647458f9b3e211590e6cc9d>:0 at Test.Droid.Views.BaseView`1[TViewModel].OnCreate (Android.OS.Bundle bundle)
[0x00000] in <0fa1f44ee2f748fe816e790571c2153b>:0 at Test.Droid.Views.MainMenuView.OnCreate (Android.OS.Bundle bundle)
[0x00000] in <0fa1f44ee2f748fe816e790571c2153b>:0 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) System.Object:e6d6ef29-3746-4c8e-b037-c64f6dfe49f0 (intptr,intptr,intptr)
This is a linking issue. You have some kind of DialogProvider, which uses the Android.Text.Html.FromHtml method, which seems to be stripped out.
You can add expressions to LinkerPleaseInclude.cs to prevent the linker from removing code or you can add [Preserve(AllMembers = true)] attribute on your DialogProvider class.

Content view content update app crashes in xamarin iOS

I create the xamarin form project and update the content view content multiple time.
Its correctly update for android. But it not work for iOS
I have update the Contentview content when click the button like that
contentView.content = mVview;
Please find the stack trace
wrapper managed-to-native
at (wrapper managed-to-native) UIKit.UIApplication:UIApplicationMain (int,string[],intptr,intptr)
at UIKit.UIApplication.Main (System.String[] args, System.IntPtr principal, System.IntPtr delegate) [0x00005] in /Users/builder/data/lanes/3969/7beaef43/source/xamarin-macios/src/UIKit/UIApplication.cs:79
at UIKit.UIApplication.Main (System.String[] args, System.String principalClassName,`/lanes/3969/7beaef43/source/xamarin-macios/src/UIKi1
when i put try catch, i got this stack trace
at Xamarin.Forms.Platform.iOS.EditorRenderer.Dispose (System.Boolean disposing) [0x00003] in C:\BuildAgent2\work\ca3766cfc22354a1\Xamarin.Forms.Platform.iOS\Renderers\EditorRenderer.cs:28
at Foundation.NSObject.Dispose () [0x00000] in /Users/builder/data/lanes/3969/7beaef43/source/xamarin-macios/src/Foundation/NSObject2.cs:133
at Xamarin.Forms.Platform.iOS.ListViewRenderer.Dispose (System.Boolean disposing) [0x001c4] in C:\BuildAgent2\work\ca3766cfc22354a1\Xamarin.Forms.Platform.iOS\Renderers\ListViewRenderer.cs:153
at Foundation.NSObject.Dispose () [0x00000] in /Users/builder/data/lanes/3969/7beaef43/source/xamarin-macios/src/Foundation/NSObject2.cs:133
at Xamarin.Forms.Platform.iOS.Platform.DisposeModelAndChildrenRenderers (Xamarin.Forms.Element view) [0x00038] in C:\BuildAgent2\work\ca3766cfc22354a1\Xamarin.Forms.Platform.iOS\Platform.cs:322
at Xamarin.Forms.Platform.iOS.Platform.HandleChildRemoved (System.Object sender, Xamarin.Forms.ElementEventArgs e) [0x00007] in C:\BuildAgent2\work\ca3766cfc22354a1\Xamarin.Forms.Platform.iOS\Platform.cs:433
at Xamarin.Forms.Element.OnDescendantRemoved (Xamarin.Forms.Element child) [0x00008] in C:\BuildAgent2\work\ca3766cfc22354a1\Xamarin.Forms.Core\Element.cs:600
at Xamarin.Forms.Element.OnDescendantRemoved (Xamarin.Forms.Element child) [0x00022] in C:\BuildAgent2\work\ca3766cfc22354a1\Xamarin.Forms.Core\Element.cs:603
at Xamarin.Forms.Element.OnDescendantRemoved (Xamarin.Forms.Element child) [0x00022] in C:\BuildAgent2\work\ca3766cfc22354a1\Xamarin.Forms.Core\Element.cs:603
at Xamarin.Forms.Element.OnChildRemoved (Xamarin.Forms.Element child) [0x00021] in C:\BuildAgent2\work\ca3766cfc22354a1\Xamarin.Forms.Core\Element.cs:367
at Xamarin.Forms.VisualElement.OnChildRemoved (Xamarin.Forms.Element child) [0x00000] in C:\BuildAgent2\work\ca3766cfc22354a1\Xamarin.Forms.Core\VisualElement.cs:578
at Xamarin.Forms.Layout.OnInternalRemoved (Xamarin.Forms.View view) [0x00012] in C:\BuildAgent2\work\ca3766cfc22354a1\Xamarin.Forms.Core\Layout.cs:413
at Xamarin.Forms.Layout.InternalChildrenOnCollectionChanged (System.Object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) [0x0002f] in C:\BuildAgent2\work\ca3766cfc22354a1\Xamarin.Forms.Core\Layout.cs:377
at System.Collections.ObjectModel.ObservableCollection`1[T].OnCollectionChanged (System.Collections.Specialized.NotifyCollectionChangedEventArgs e) [0x00012] in /Users/builder/data/lanes/3969/7beaef43/source/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/referencesource/System/compmod/system/collections/objectmodel/observablecollection.cs:288
at System.Collections.ObjectModel.ObservableCollection`1[T].OnCollectionChanged (System.Collections.Specialized.NotifyCollectionChangedAction action, System.Object item, System.Int32 index) [0x00000] in /Users/builder/data/lanes/3969/7beaef43/source/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/referencesource/System/compmod/system/collections/objectmodel/observablecollection.cs:351
at System.Collections.ObjectModel.ObservableCollection`1[T].RemoveItem (System.Int32 index) [0x0002b] in /Users/builder/data/lanes/3969/7beaef43/source/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/referencesource/System/compmod/system/collections/objectmodel/observablecollection.cs:205
at System.Collections.ObjectModel.Collection`1[T].Remove (T item) [0x0002d] in /Users/builder/data/lanes/3969/7beaef43/source/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/referencesource/mscorlib/system/collections/objectmodel/collection.cs:113
at Xamarin.Forms.TemplateUtilities.OnContentChanged (Xamarin.Forms.BindableObject bindable, System.Object oldValue, System.Object newValue) [0x0001a] in C:\BuildAgent2\work\ca3766cfc22354a1\Xamarin.Forms.Core\TemplateUtilities.cs:63
at Xamarin.Forms.BindableObject.SetValueActual (Xamarin.Forms.BindableProperty property, Xamarin.Forms.BindableObject+BindablePropertyContext context, System.Object value, System.Boolean currentlyApplying, Xamarin.Forms.BindableObject+SetValueFlags attributes, System.Boolean silent) [0x00108] in C:\BuildAgent2\work\ca3766cfc22354a1\Xamarin.Forms.Core\BindableObject.cs:584
at Xamarin.Forms.BindableObject.SetValueCore (Xamarin.Forms.BindableProperty property, System.Object value, Xamarin.Forms.BindableObject+SetValueFlags attributes, Xamarin.Forms.BindableObject+SetValuePrivateFlags privateAttributes) [0x0014b] in C:\BuildAgent2\work\ca3766cfc22354a1\Xamarin.Forms.Core\BindableObject.cs:378
at Xamarin.Forms.BindableObject.SetValue (Xamarin.Forms.BindableProperty property, System.Object value, System.Boolean fromStyle, System.Boolean checkAccess) [0x0005f] in C:\BuildAgent2\work\ca3766cfc22354a1\Xamarin.Forms.Core\BindableObject.cs:531
at Xamarin.Forms.BindableObject.SetValue (Xamarin.Forms.BindableProperty property, System.Object value) [0x00000] in C:\BuildAgent2\work\ca3766cfc22354a1\Xamarin.Forms.Core\BindableObject.cs:83
at Xamarin.Forms.ContentView.set_Content (Xamarin.Forms.View value) [0x00000] in C:\BuildAgent2\work\ca3766cfc22354a1\Xamarin.Forms.Core\ContentView.cs:11
at EgnatiumFull.Pages.QuestionAnswerPage.UpdateTheQuestionLayout () [0x00144] in /Volumes/MS/prjects/Egnatium/EgnatiumFinal/EgnatiumFinal/EgnatiumFinal/Pages/QuestionAnswerPage.cs:539
at EgnatiumFull.Pages.QuestionAnswerPage+<OnAppearing>c__async1.MoveNext () [0x0007e] in /Volumes/MS/prjects/Egnatium/EgnatiumFinal/EgnatiumFinal/EgnatiumFinal/Pages/QuestionAnswerPage.cs:383
--- End of stack trace from previous location where exception was thrown ---
at (wrapper managed-to-native) UIKit.UIApplication:UIApplicationMain (int,string[],intptr,intptr)
at UIKit.UIApplication.Main (System.String[] args, System.IntPtr principal, System.IntPtr delegate) [0x00005] in /Users/builder/data/lanes/3969/7beaef43/source/xamarin-macios/src/UIKit/UIApplication.cs:79
at UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x00038] in /Users/builder/data/lanes/3969/7beaef43/source/xamarin-macios/src/UIKit/UIApplication.cs:63
at EgnatiumFinal.iOS.Application.Main (System.String[] args) [0x00008] in /Users/saifamily/Documents/14_2_17/EgnatiumFinal/EgnatiumFinal/EgnatiumFinal.iOS/Main.cs:17 xa
Finally I found the solution in my own way, i think i don't know is this correct way but in my case it work perfectly
I rendererd the list view for ios and overide the methods dispose with try/catch statement
protected override void Dispose()
{
try{
base.Dispose();
}
Catch(Exception ex)
{
return;
}
}

Using Microsoft.CodeAnalysis / Roslyn on Mono

I'm trying to run a simple line in Mono, using Microsoft.CodeAnalysis:
var workspace = MSBuildWorkspace.Create();
But the problem is that it seems that it can't load roslyn libraries because we are using Mono:
Unhandled Exception:
System.Reflection.ReflectionTypeLoadException: The classes in the module cannot be loaded.
at (wrapper managed-to-native) System.Reflection.Assembly:GetTypes (System.Reflection.Assembly,bool)
at System.Reflection.Assembly.GetTypes () [0x00000] in /private/tmp/source-mono-4.6.0/bockbuild-mono-4.6.0-branch/profiles/mono-mac-xamarin/build-root/mono-x86/mcs/class/corlib/System.Reflection/Assembly.cs:405
at System.Reflection.Assembly+<>c__Iterator0.MoveNext () [0x00021] in /private/tmp/source-mono-4.6.0/bockbuild-mono-4.6.0-branch/profiles/mono-mac-xamarin/build-root/mono-x86/mcs/class/corlib/System.Reflection/Assembly.cs:999
at System.Linq.Enumerable+WhereSelectEnumerableIterator`2[TSource,TResult].MoveNext () [0x00078] in /private/tmp/source-mono-4.6.0/bockbuild-mono-4.6.0-branch/profiles/mono-mac-xamarin/build-root/mono-x86/mcs/class/referencesource/System.Core/System/Linq/Enumerable.cs:282
at System.Linq.Enumerable+<SelectManyIterator>c__Iterator2`2[TSource,TResult].MoveNext () [0x0009a] in /private/tmp/source-mono-4.6.0/bockbuild-mono-4.6.0-branch/profiles/mono-mac-xamarin/build-root/mono-x86/mcs/class/referencesource/System.Core/System/Linq/Enumerable.cs:424
at System.Composition.TypedParts.TypedPartExportDescriptorProvider..ctor (System.Collections.Generic.IEnumerable`1[T] types, System.Composition.Convention.AttributedModelProvider attributeContext) [0x00049] in <c909a8424f424533a07db3f5e57b744b>:0
at System.Composition.Hosting.ContainerConfiguration.CreateContainer () [0x00042] in <c909a8424f424533a07db3f5e57b744b>:0
at Microsoft.CodeAnalysis.Host.Mef.MefHostServices.Create (System.Collections.Generic.IEnumerable`1[T] assemblies) [0x00019] in <947408acdcbc4eba93cdb6a19d92fcd1>:0
at Microsoft.CodeAnalysis.Host.Mef.DesktopMefHostServices.get_DefaultServices () [0x00011] in <2ba3a08d4fe0467c8c54c8bc37c61987>:0
at Microsoft.CodeAnalysis.MSBuild.MSBuildWorkspace.Create (System.Collections.Generic.IDictionary`2[TKey,TValue] properties) [0x00000] in <2ba3a08d4fe0467c8c54c8bc37c61987>:0
at Microsoft.CodeAnalysis.MSBuild.MSBuildWorkspace.Create () [0x00000] in <2ba3a08d4fe0467c8c54c8bc37c61987>:0
at UTQGValidatorPluginCSharp.Program.CountProject (System.String solutionPath) [0x00001] in /Users/s/projects/xo/devfactory-utqg-csharp/src/UTQGValidatorPluginCSharp/Program.cs:31
at UTQGValidatorPluginCSharp.Program.Main (System.String[] args) [0x00052] in /Users/s/projects/xo/devfactory-utqg-csharp/src/UTQGValidatorPluginCSharp/Program.cs:25
[ERROR] FATAL UNHANDLED EXCEPTION: System.Reflection.ReflectionTypeLoadException: The classes in the module cannot be loaded.
at (wrapper managed-to-native) System.Reflection.Assembly:GetTypes (System.Reflection.Assembly,bool)
at System.Reflection.Assembly.GetTypes () [0x00000] in /private/tmp/source-mono-4.6.0/bockbuild-mono-4.6.0-branch/profiles/mono-mac-xamarin/build-root/mono-x86/mcs/class/corlib/System.Reflection/Assembly.cs:405
at System.Reflection.Assembly+<>c__Iterator0.MoveNext () [0x00021] in /private/tmp/source-mono-4.6.0/bockbuild-mono-4.6.0-branch/profiles/mono-mac-xamarin/build-root/mono-x86/mcs/class/corlib/System.Reflection/Assembly.cs:999
at System.Linq.Enumerable+WhereSelectEnumerableIterator`2[TSource,TResult].MoveNext () [0x00078] in /private/tmp/source-mono-4.6.0/bockbuild-mono-4.6.0-branch/profiles/mono-mac-xamarin/build-root/mono-x86/mcs/class/referencesource/System.Core/System/Linq/Enumerable.cs:282
at System.Linq.Enumerable+<SelectManyIterator>c__Iterator2`2[TSource,TResult].MoveNext () [0x0009a] in /private/tmp/source-mono-4.6.0/bockbuild-mono-4.6.0-branch/profiles/mono-mac-xamarin/build-root/mono-x86/mcs/class/referencesource/System.Core/System/Linq/Enumerable.cs:424
at System.Composition.TypedParts.TypedPartExportDescriptorProvider..ctor (System.Collections.Generic.IEnumerable`1[T] types, System.Composition.Convention.AttributedModelProvider attributeContext) [0x00049] in <c909a8424f424533a07db3f5e57b744b>:0
at System.Composition.Hosting.ContainerConfiguration.CreateContainer () [0x00042] in <c909a8424f424533a07db3f5e57b744b>:0
at Microsoft.CodeAnalysis.Host.Mef.MefHostServices.Create (System.Collections.Generic.IEnumerable`1[T] assemblies) [0x00019] in <947408acdcbc4eba93cdb6a19d92fcd1>:0
at Microsoft.CodeAnalysis.Host.Mef.DesktopMefHostServices.get_DefaultServices () [0x00011] in <2ba3a08d4fe0467c8c54c8bc37c61987>:0
at Microsoft.CodeAnalysis.MSBuild.MSBuildWorkspace.Create (System.Collections.Generic.IDictionary`2[TKey,TValue] properties) [0x00000] in <2ba3a08d4fe0467c8c54c8bc37c61987>:0
at Microsoft.CodeAnalysis.MSBuild.MSBuildWorkspace.Create () [0x00000] in <2ba3a08d4fe0467c8c54c8bc37c61987>:0
at UTQGValidatorPluginCSharp.Program.CountProject (System.String solutionPath) [0x00001] in /Users/s/projects/xo/devfactory-utqg-csharp/src/UTQGValidatorPluginCSharp/Program.cs:31
at UTQGValidatorPluginCSharp.Program.Main (System.String[] args) [0x00052] in /Users/s/projects/xo/devfactory-utqg-csharp/src/UTQGValidatorPluginCSharp/Program.cs:25
But according with this thread, Roslyn was completely integrated into Mono.
Is there any way to get it working on Mono? If yes, how should I do this?

Categories