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;
}
}
Related
PCL Project Which Crashes after Splash Screen on IOS
I have a try catch on IOS StartUp
On Main.cs
try
{
UIApplication.Main(args, null, "AppDelegate");
}
catch (System.Exception exception)
{
Crashes.TrackError(exception);
}
So i debug the project and it goes to App()
And When InitializeComponent();
It goes into catch with
Exception Message: Cannot invoke method with stack pointers via reflection
Here's StackTrace
at System.Reflection.RuntimeMethodInfo.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00096] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/mcs/class/corlib/System.Reflection/RuntimeMethodInfo.cs:426
at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/external/corefx/src/Common/src/CoreLib/System/Reflection/MethodBase.cs:53
at Xamarin.Forms.Xaml.TypeConversionExtensions.ConvertTo (System.Object value, System.Type toType, System.Func`1[TResult] getConverter, System.IServiceProvider serviceProvider) [0x002f8] in D:\agent\_work\1\s\Xamarin.Forms.Core\Xaml\TypeConversionExtensions.cs:180
at Xamarin.Forms.Xaml.TypeConversionExtensions.ConvertTo (System.Object value, System.Type toType, System.Func`1[TResult] minfoRetriever, System.IServiceProvider serviceProvider) [0x00021] in D:\agent\_work\1\s\Xamarin.Forms.Core\Xaml\TypeConversionExtensions.cs:76
at Xamarin.Forms.Xaml.ApplyPropertiesVisitor.TrySetProperty (System.Object element, System.String localName, System.Object value, System.Xml.IXmlLineInfo lineInfo, Xamarin.Forms.Xaml.Internals.XamlServiceProvider serviceProvider, Xamarin.Forms.Xaml.HydrationContext context, System.Exception& exception) [0x00090] in D:\agent\_work\1\s\Xamarin.Forms.Xaml\ApplyPropertiesVisitor.cs:479
at Xamarin.Forms.Xaml.ApplyPropertiesVisitor.SetPropertyValue (System.Object xamlelement, Xamarin.Forms.Xaml.XmlName propertyName, System.Object value, System.Object rootElement, Xamarin.Forms.Xaml.INode node, Xamarin.Forms.Xaml.HydrationContext context, System.Xml.IXmlLineInfo lineInfo) [0x0008d] in D:\agent\_work\1\s\Xamarin.Forms.Xaml\ApplyPropertiesVisitor.cs:334
at Xamarin.Forms.Xaml.ApplyPropertiesVisitor.Visit (Xamarin.Forms.Xaml.ValueNode node, Xamarin.Forms.Xaml.INode parentNode) [0x0005d] in D:\agent\_work\1\s\Xamarin.Forms.Xaml\ApplyPropertiesVisitor.cs:52
at Xamarin.Forms.Xaml.ValueNode.Accept (Xamarin.Forms.Xaml.IXamlNodeVisitor visitor, Xamarin.Forms.Xaml.INode parentNode) [0x00000] in D:\agent\_work\1\s\Xamarin.Forms.Xaml\XamlNode.cs:86
at Xamarin.Forms.Xaml.ElementNode.Accept (Xamarin.Forms.Xaml.IXamlNodeVisitor visitor, Xamarin.Forms.Xaml.INode parentNode) [0x00043] in D:\agent\_work\1\s\Xamarin.Forms.Xaml\XamlNode.cs:143
at Xamarin.Forms.Xaml.ElementNode.Accept (Xamarin.Forms.Xaml.IXamlNodeVisitor visitor, Xamarin.Forms.Xaml.INode parentNode) [0x00078] in D:\agent\_work\1\s\Xamarin.Forms.Xaml\XamlNode.cs:145
at Xamarin.Forms.Xaml.FillResourceDictionariesVisitor.Visit (Xamarin.Forms.Xaml.ElementNode node, Xamarin.Forms.Xaml.INode parentNode) [0x000bf] in D:\agent\_work\1\s\Xamarin.Forms.Xaml\FillResourceDictionariesVisitor.cs:52
at Xamarin.Forms.Xaml.ElementNode.Accept (Xamarin.Forms.Xaml.IXamlNodeVisitor visitor, Xamarin.Forms.Xaml.INode parentNode) [0x00012] in D:\agent\_work\1\s\Xamarin.Forms.Xaml\XamlNode.cs:139
at Xamarin.Forms.Xaml.ElementNode.Accept (Xamarin.Forms.Xaml.IXamlNodeVisitor visitor, Xamarin.Forms.Xaml.INode parentNode) [0x00078] in D:\agent\_work\1\s\Xamarin.Forms.Xaml\XamlNode.cs:145
at Xamarin.Forms.Xaml.RootNode.Accept (Xamarin.Forms.Xaml.IXamlNodeVisitor visitor, Xamarin.Forms.Xaml.INode parentNode) [0x00043] in D:\agent\_work\1\s\Xamarin.Forms.Xaml\XamlNode.cs:201
at Xamarin.Forms.Xaml.XamlLoader.Visit (Xamarin.Forms.Xaml.RootNode rootnode, Xamarin.Forms.Xaml.HydrationContext visitorContext) [0x0006e] in D:\agent\_work\1\s\Xamarin.Forms.Xaml\XamlLoader.cs:140
at Xamarin.Forms.Xaml.XamlLoader.Load (System.Object view, System.String xaml) [0x0004b] in D:\agent\_work\1\s\Xamarin.Forms.Xaml\XamlLoader.cs:89
at Xamarin.Forms.Xaml.XamlLoader.Load (System.Object view, System.Type callingType) [0x0002f] in D:\agent\_work\1\s\Xamarin.Forms.Xaml\XamlLoader.cs:68
at Xamarin.Forms.Xaml.Extensions.LoadFromXaml[TXaml] (TXaml view, System.Type callingType) [0x00000] in D:\agent\_work\1\s\Xamarin.Forms.Xaml\ViewExtensions.cs:36
at MyApp.App.InitializeComponent () [0x00001] in /Users/bkp/Downloads/MyApp-xamarin/Source/MyApp/MyApp/obj/Debug/MyApp.App.xaml.g.cs:19
at MyApp.App..ctor () [0x00008] in /Users/bkp/Downloads/MyApp-xamarin/Source/MyApp/MyApp/App.xaml.cs:22
at MyApp.iOS.AppDelegate.FinishedLaunching (UIKit.UIApplication uiApplication, Foundation.NSDictionary launchOptions) [0x00034] in /Users/bkp/Downloads/MyApp-xamarin/Source/MyApp/iOS/AppDelegate.cs:51
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.18.3.2/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.18.3.2/src/Xamarin.iOS/UIKit/UIApplication.cs:65
at MyApp.iOS.Application.Main (System.String[] args) [0x00002] in /Users/bkp/Downloads/MyApp-xamarin/Source/MyApp/iOS/Main.cs:15
What causing this exception?
can someone help me out with it
Updating Xamarin.forms Resolved my issue
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
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.
I want to bind a TouchUpInside event to a custom control on Xamarin iOS with MugenMvvm.
bindingSet.Bind(moreThanFourHoursButton).To(() => (vm, ctx) => vm.TimeButtonClickedCommand)
I tried the above code but I get following Exception:
Error: The binding member cannot be obtained from the path 'DefaultBindingMember' on the 'Mobile.EDevice.iOS.Views.Custom.TimeButton'.
at MugenMvvmToolkit.Binding.Infrastructure.BindingMemberProvider.GetBindingMember (System.Type sourceType, System.String path, System.Boolean ignoreAttachedMembers, System.Boolean throwOnError) [0x0010a] in <89993fb2052d4882bce9f7d6fb2304e4>:0
at MugenMvvmToolkit.Binding.BindingExtensions.TryGetBindingMemberValue[TSource,TValue] (TSource source, MugenMvvmToolkit.Binding.Models.BindingMemberDescriptor2[TSource,TValue] member, System.Object[] args, System.Boolean throwOnError, TValue& value) [0x0003f] in <89993fb2052d4882bce9f7d6fb2304e4>:0
at MugenMvvmToolkit.Binding.BindingExtensions.GetBindingMemberValue[TSource,TValue] (TSource source, MugenMvvmToolkit.Binding.Models.BindingMemberDescriptor2[TSource,TValue] member, System.Object[] args) [0x00000] in <89993fb2052d4882bce9f7d6fb2304e4>:0
at MugenMvvmToolkit.Binding.BindingExtensions.GetBindingMemberValue[TSource,TValue] (TSource source, MugenMvvmToolkit.Binding.Models.BindingMemberDescriptor2[TSource,TValue] member) [0x00007] in <89993fb2052d4882bce9f7d6fb2304e4>:0
at MugenMvvmToolkit.Binding.BindingBuilderExtensions.Bind[TTarget,TSource] (MugenMvvmToolkit.Binding.Interfaces.IBindingBuilder builder, TTarget targetGeneric) [0x00000] in <89993fb2052d4882bce9f7d6fb2304e4>:0
at MugenMvvmToolkit.Binding.Builders.BindingSet1[TSource].Bind[TLocalTarget] (TLocalTarget target) [0x00006] in <89993fb2052d4882bce9f7d6fb2304e4>:0
at Mobile.EDevice.iOS.Views.Controllers.ActivityTracking.ActivityDurationViewController.ViewDidLoad () [0x00a1b] in /Users/Admin/Documents/CimziaCompanionApp-Mobile/src/iOS/Views/Controllers/ActivityTracking/ActivityDurationViewController.cs:154
at (wrapper managed-to-native) ObjCRuntime.Messaging:void_objc_msgSendSuper_IntPtr_bool_IntPtr (intptr,intptr,intptr,bool,intptr)
at UIKit.UIViewController.PresentViewController (UIKit.UIViewController viewControllerToPresent, System.Boolean animated, System.Action completionHandler) [0x0006e] in /Users/builder/data/lanes/4691/d2270eec/source/xamarin-macios/src/build/ios/native/UIKit/UIViewController.g.cs:789
at MugenMvvmToolkit.iOS.Infrastructure.Mediators.ModalViewMediator.ShowView (MugenMvvmToolkit.iOS.Interfaces.Views.IModalView view, System.Boolean isDialog, MugenMvvmToolkit.Interfaces.Models.IDataContext context) [0x0005f] in <5ec134adfe6542a4bd7f31656741c9a6>:0
at MugenMvvmToolkit.Infrastructure.Mediators.WindowViewMediatorBase1+<>c[TView].<ShowInternal>b__55_2 (MugenMvvmToolkit.Infrastructure.Mediators.WindowViewMediatorBase1[TView] base, System.Boolean b, MugenMvvmToolkit.Interfaces.Models.IDataContext arg3) [0x00007]
Ok, so I figured it out, this is how I bind my Command to a custom EventHandler:
bindingSet.Bind(moreThanFourHoursButton, nameof(moreThanFourHoursButton.Click)).To(() => (vm, ctx) => vm.TimeButtonClickedCommand)
when i double click on Clicked signals to add new Clicked event, it not automatic add code. it show error
i use newest version of Monodevelop and Gtk# Toolkit and Window7 platform
how to fix it ??
Try to add it manually.
Into constructor of your window class write:
yourElement.Clicked += new EventHandler(Method);
void Method(~)
{
//logic
}
Where EventHandler is a delegate type of Clicked event, and Method is a method, which have same with EventHandler signature.
This is a bug still present in MonoDevelop 3.0.1. Look below for the full stacktrace. Adding an even manually is like Arman Stepanyan described it.
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.NotImplementedException: The requested feature is not implemented.
at MonoDevelop.Ide.TypeSystem.CodeGenerationService.GetSuitableInsertionPoint (IEnumerable`1 points, IUnresolvedTypeDefinition cls, IUnresolvedMember member) [0x0003e] in /build/buildd/monodevelop-3.0.1/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/CodeGenerationService.cs:335
at MonoDevelop.Ide.TypeSystem.CodeGenerationService.AddNewMember (ITypeDefinition type, IUnresolvedTypeDefinition part, IUnresolvedMember newMember, Boolean implementExplicit) [0x00043] in /build/buildd/monodevelop-3.0.1/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/CodeGenerationService.cs:91
at MonoDevelop.GtkCore.GuiBuilder.CodeBinder.BindSignal (Stetic.Signal signal) [0x000de] in /build/buildd/monodevelop-3.0.1/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.GuiBuilder/CodeBinder.cs:182
at MonoDevelop.GtkCore.GuiBuilder.GuiBuilderView.OnSignalAdded (System.Object sender, Stetic.ComponentSignalEventArgs args) [0x00000] in /build/buildd/monodevelop-3.0.1/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.GuiBuilder/GuiBuilderView.cs:316
at Stetic.WidgetDesigner.OnSignalAdded (System.Object sender, Stetic.ComponentSignalEventArgs args) [0x00000] in :0
at Stetic.Project+c_AnonStoreyD.<>m_17 (System.Object , System.EventArgs ) [0x00000] in :0
at Stetic.GuiDispatch.InvokeSync (System.EventHandler h) [0x00000] in :0
at Stetic.Project.NotifySignalAdded (System.Object obj, System.String name, Stetic.Signal signal) [0x00000] in :0
at (wrapper remoting-invoke-with-check) Stetic.Project:NotifySignalAdded (object,string,Stetic.Signal)
at Stetic.ProjectBackend.Stetic.IProject.NotifySignalAdded (Stetic.SignalEventArgs args) [0x00000] in :0
at Stetic.ObjectWrapper.OnSignalAdded (Stetic.SignalEventArgs args) [0x00000] in :0
at Stetic.SignalCollection.OnInsertComplete (Int32 index, System.Object value) [0x00000] in :0
at System.Collections.CollectionBase.System.Collections.IList.Add (System.Object value) [0x00000] in :0
--- End of inner exception stack trace ---
at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in :0
at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) [0x00000] in :0
at System.Delegate.DynamicInvokeImpl (System.Object[] args) [0x00000] in :0
at System.MulticastDelegate.DynamicInvokeImpl (System.Object[] args) [0x00000] in :0
at System.Delegate.DynamicInvoke (System.Object[] args) [0x00000] in :0
at GLib.Signal.ClosureInvokedCB (System.Object o, GLib.ClosureInvokedArgs args) [0x00000] in :0
at GLib.SignalClosure.Invoke (GLib.ClosureInvokedArgs args) [0x00000] in :0
at GLib.SignalClosure.MarshalCallback (IntPtr raw_closure, IntPtr return_val, UInt32 n_param_vals, IntPtr param_values, IntPtr invocation_hint, IntPtr marshal_data) [0x00000] in :0