Closed Tommigun1980 closed 3 years ago
More information:
[2020-03-30 08:19:02.3] Renderer >> 4 [monodroid] SWITCHING CONTEXT
[2020-03-30 08:19:02.3] Renderer >> 4 [monodroid] SWITCHING CONTEXT
[2020-03-30 08:19:02.3] Renderer >> INFO: Trying to load class xamarindesigner.AndroidFormsPreviewerRenderer
[2020-03-30 08:19:02.3] Renderer >>
[2020-03-30 08:19:02.3] Renderer >> INFO: InstantiateObject(): ResourceProvider2: Enabled - CreateFromXamlWithDesignPropsDelegate: Enabled.
[2020-03-30 08:19:02.3] Renderer >> INFO: InstantiateObject() => ShouldRender() => true (SwipeViewTest.App is not a VisualElement)
[2020-03-30 08:19:02.3] Renderer >> INFO: ResourceProvider2: SwipeViewTest: App.xaml (isMainFile: True)
[2020-03-30 08:19:02.3] Renderer >> INFO: ResourceProvider2: SwipeViewTest: MainPage.xaml (isMainFile: False)
[2020-03-30 08:19:02.3] Renderer >> INFO: FallbackTypeResolverHandler() => ShouldRender() => true (Xamarin.Forms.Label is a Forms type)
[2020-03-30 08:19:02.3] Renderer >> INFO: FallbackTypeResolverHandler() => ShouldRender() => true (Xamarin.Forms.Label is a Forms type)
[2020-03-30 08:19:02.3] Renderer >> INFO: FallbackTypeResolverHandler() => ShouldRender() => true (Xamarin.Forms.Grid is a Forms type)
[2020-03-30 08:19:02.3] Renderer >> INFO: FallbackTypeResolverHandler() => ShouldRender() => true (Xamarin.Forms.SwipeView is a Forms type)
[2020-03-30 08:19:02.3] Renderer >> INFO: FallbackTypeResolverHandler() => ShouldRender() => true (Xamarin.Forms.StackLayout is a Forms type)
[2020-03-30 08:19:02.3] Renderer >> INFO: XamarinFormsLoaderAndroid >>> InitializeApplication -> Found a RegisterHandlers method.
[2020-03-30 08:19:02.3] Renderer >> INFO: InstantiateObject(): ResourceProvider2: Enabled - CreateFromXamlWithDesignPropsDelegate: Enabled.
[2020-03-30 08:19:02.3] Renderer >> INFO: InstantiateObject() => ShouldRender() => false (SwipeViewTest.MainPage is not DesignTimeVisible, nor does it implement IComponent)
[2020-03-30 08:19:02.3] Renderer >> INFO: FallbackTypeResolverHandler() => ShouldRender() => true (Xamarin.Forms.ContentPage is a Forms type)
[2020-03-30 08:19:02.3] Renderer >> INFO: FallbackTypeResolverHandler() => ShouldRender() => true (Xamarin.Forms.Label is a Forms type)
[2020-03-30 08:19:02.3] Renderer >> INFO: FallbackTypeResolverHandler() => ShouldRender() => true (Xamarin.Forms.Label is a Forms type)
[2020-03-30 08:19:02.3] Renderer >> INFO: FallbackTypeResolverHandler() => ShouldRender() => true (Xamarin.Forms.Grid is a Forms type)
[2020-03-30 08:19:02.3] Renderer >> INFO: FallbackTypeResolverHandler() => ShouldRender() => true (Xamarin.Forms.SwipeView is a Forms type)
[2020-03-30 08:19:02.3] Renderer >> INFO: FallbackTypeResolverHandler() => ShouldRender() => true (Xamarin.Forms.StackLayout is a Forms type)
[2020-03-30 08:19:02.3] Renderer >> 4 [monodroid] SWITCHING CONTEXT
[2020-03-30 08:19:02.3] ERROR: : The renderer encountered an error while rendering this file: System.InvalidOperationException: The class, property, or method you are attempting to use ('.ctor') is part of SwipeView; to use it, you must opt-in by calling Forms.SetFlags("SwipeView_Experimental") before calling Forms.Init().
Xamarin.Forms.ExperimentalFlags.VerifyFlagEnabled (System.String coreComponentName, System.String flagName, System.String constructorHint, System.String memberName) in D:\a\1\s\Xamarin.Forms.Core\ExperimentalFlags.cs:38
Xamarin.Forms.SwipeView.VerifySwipeViewFlagEnabled (System.String constructorHint, System.String memberName) in D:\a\1\s\Xamarin.Forms.Core\SwipeView.cs:25
Xamarin.Forms.Platform.Android.SwipeViewRenderer..ctor (Android.Content.Context context) in D:\a\1\s\Xamarin.Forms.Platform.Android\Renderers\SwipeViewRenderer.cs:48
<unknown method>
System.Reflection.RuntimeConstructorInfo.InternalInvoke (System.Object obj, System.Object[] parameters, System.Boolean wrapExceptions) in /Users/builder/jenkins/workspace/archive-mono/2019-10/android/release/mcs/class/corlib/System.Reflection/RuntimeMethodInfo.cs:936
[2020-03-30 08:19:02.3] ERROR: : AndroidXamlRenderer had a rendering error: System.InvalidOperationException: The class, property, or method you are attempting to use ('.ctor') is part of SwipeView; to use it, you must opt-in by calling Forms.SetFlags("SwipeView_Experimental") before calling Forms.Init().
Xamarin.Forms.ExperimentalFlags.VerifyFlagEnabled (System.String coreComponentName, System.String flagName, System.String constructorHint, System.String memberName) in D:\a\1\s\Xamarin.Forms.Core\ExperimentalFlags.cs:38
Xamarin.Forms.SwipeView.VerifySwipeViewFlagEnabled (System.String constructorHint, System.String memberName) in D:\a\1\s\Xamarin.Forms.Core\SwipeView.cs:25
Xamarin.Forms.Platform.Android.SwipeViewRenderer..ctor (Android.Content.Context context) in D:\a\1\s\Xamarin.Forms.Platform.Android\Renderers\SwipeViewRenderer.cs:48
<unknown method>
System.Reflection.RuntimeConstructorInfo.InternalInvoke (System.Object obj, System.Object[] parameters, System.Boolean wrapExceptions) in /Users/builder/jenkins/workspace/archive-mono/2019-10/android/release/mcs/class/corlib/System.Reflection/RuntimeMethodInfo.cs:936
This actually breaks Android builds as well outside the XAML previewer. On iOS it's fine, but on Android it throws an error claiming that the "SwipeView_Experimental" flag has not been set when running in the emulator. It is definitely set in my MainActivity.cs before calling Forms.Init():
protected override void OnCreate(Bundle savedInstanceState)
{
...
global::Xamarin.Forms.Forms.SetFlags("SwipeView_Experimental");
...
global::Xamarin.Forms.Forms.Init(this, savedInstanceState);
...
}
Here is the full stack trace (UXDivers.Grial.Repeater is the view that contains the swipe view as a child):
03-31 07:13:46.483 I/MonoDroid( 6386): UNHANDLED EXCEPTION:
03-31 07:13:46.509 I/MonoDroid( 6386): System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.InvalidOperationException: The class, property, or method you are attempting to use ('.ctor') is part of SwipeView; to use it, you must opt-in by calling Forms.SetFlags("SwipeView_Experimental") before calling Forms.Init().
03-31 07:13:46.509 I/MonoDroid( 6386): at Xamarin.Forms.ExperimentalFlags.VerifyFlagEnabled (System.String coreComponentName, System.String flagName, System.String constructorHint, System.String memberName) [0x0007d] in <b5f62705a3ea4249ac22723294e68624>:0
03-31 07:13:46.509 I/MonoDroid( 6386): at Xamarin.Forms.SwipeView.VerifySwipeViewFlagEnabled (System.String constructorHint, System.String memberName) [0x00000] in <b5f62705a3ea4249ac22723294e68624>:0
03-31 07:13:46.509 I/MonoDroid( 6386): at Xamarin.Forms.Platform.Android.SwipeViewRenderer..ctor (Android.Content.Context context) [0x00007] in <a7ac3b6d91f842e994e10fc68a00fc53>:0
03-31 07:13:46.509 I/MonoDroid( 6386): at (wrapper managed-to-native) System.Reflection.RuntimeConstructorInfo.InternalInvoke(System.Reflection.RuntimeConstructorInfo,object,object[],System.Exception&)
03-31 07:13:46.509 I/MonoDroid( 6386): at System.Reflection.RuntimeConstructorInfo.InternalInvoke (System.Object obj, System.Object[] parameters, System.Boolean wrapExceptions) [0x00005] in <629bcb146d674f9e83b55f4a64e6918c>:0
03-31 07:13:46.509 I/MonoDroid( 6386): --- End of inner exception stack trace ---
03-31 07:13:46.509 I/MonoDroid( 6386): at System.Reflection.RuntimeConstructorInfo.InternalInvoke (System.Object obj, System.Object[] parameters, System.Boolean wrapExceptions) [0x0001d] in <629bcb146d674f9e83b55f4a64e6918c>:0
03-31 07:13:46.509 I/MonoDroid( 6386): at System.Reflection.RuntimeConstructorInfo.DoInvoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00086] in <629bcb146d674f9e83b55f4a64e6918c>:0
03-31 07:13:46.509 I/MonoDroid( 6386): at System.Reflection.RuntimeConstructorInfo.Invoke (System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <629bcb146d674f9e83b55f4a64e6918c>:0
03-31 07:13:46.509 I/MonoDroid( 6386): at System.RuntimeType.CreateInstanceImpl (System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder binder, System.Object[] args, System.Globalization.CultureInfo culture, System.Object[] activationAttributes, System.Threading.StackCrawlMark& stackMark) [0x0022b] in <629bcb146d674f9e83b55f4a64e6918c>:0
03-31 07:13:46.509 I/MonoDroid( 6386): at System.Activator.CreateInstance (System.Type type, System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder binder, System.Object[] args, System.Globalization.CultureInfo culture, System.Object[] activationAttributes) [0x0009c] in <629bcb146d674f9e83b55f4a64e6918c>:0
03-31 07:13:46.509 I/MonoDroid( 6386): at System.Activator.CreateInstance (System.Type type, System.Object[] args) [0x00000] in <629bcb146d674f9e83b55f4a64e6918c>:0
03-31 07:13:46.509 I/MonoDroid( 6386): at Xamarin.Forms.Internals.DependencyResolver.ResolveOrCreate (System.Type type, System.Object source, System.Type visualType, System.Object[] args) [0x000af] in <b5f62705a3ea4249ac22723294e68624>:0
03-31 07:13:46.509 I/MonoDroid( 6386): at Xamarin.Forms.Internals.Registrar`1[TRegistrable].GetHandler (System.Type type, System.Object source, Xamarin.Forms.IVisual visual, System.Object[] args) [0x00060] in <b5f62705a3ea4249ac22723294e68624>:0
03-31 07:13:46.509 I/MonoDroid( 6386): at Xamarin.Forms.Internals.Registrar`1[TRegistrable].GetHandlerForObject[TOut] (System.Object obj, System.Object[] args) [0x00041] in <b5f62705a3ea4249ac22723294e68624>:0
03-31 07:13:46.509 I/MonoDroid( 6386): at Xamarin.Forms.Platform.Android.Platform.CreateRenderer (Xamarin.Forms.VisualElement element, Android.Content.Context context) [0x00005] in <a7ac3b6d91f842e994e10fc68a00fc53>:0
03-31 07:13:46.509 I/MonoDroid( 6386): at Xamarin.Forms.Platform.Android.VisualElementPackager.AddChild (Xamarin.Forms.VisualElement view, Xamarin.Forms.Platform.Android.IVisualElementRenderer oldRenderer, Xamarin.Forms.Platform.Android.RendererPool pool, System.Boolean sameChildren) [0x000c4] in <a7ac3b6d91f842e994e10fc68a00fc53>:0
03-31 07:13:46.509 I/MonoDroid( 6386): at Xamarin.Forms.Platform.Android.VisualElementPackager.OnChildAdded (System.Object sender, Xamarin.Forms.ElementEventArgs e) [0x0000f] in <a7ac3b6d91f842e994e10fc68a00fc53>:0
03-31 07:13:46.509 I/MonoDroid( 6386): at Xamarin.Forms.Element.OnChildAdded (Xamarin.Forms.Element child) [0x00022] in <b5f62705a3ea4249ac22723294e68624>:0
03-31 07:13:46.509 I/MonoDroid( 6386): at Xamarin.Forms.VisualElement.OnChildAdded (Xamarin.Forms.Element child) [0x00000] in <b5f62705a3ea4249ac22723294e68624>:0
03-31 07:13:46.510 I/MonoDroid( 6386): at Xamarin.Forms.Layout`1[T].OnChildAdded (Xamarin.Forms.Element child) [0x00000] in <b5f62705a3ea4249ac22723294e68624>:0
03-31 07:13:46.510 I/MonoDroid( 6386): at Xamarin.Forms.Layout.OnInternalAdded (Xamarin.Forms.View view) [0x0001d] in <b5f62705a3ea4249ac22723294e68624>:0
03-31 07:13:46.510 I/MonoDroid( 6386): at Xamarin.Forms.Layout.InternalChildrenOnCollectionChanged (System.Object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) [0x00078] in <b5f62705a3ea4249ac22723294e68624>:0
03-31 07:13:46.510 I/MonoDroid( 6386): at (wrapper delegate-invoke) <Module>.invoke_void_object_NotifyCollectionChangedEventArgs(object,System.Collections.Specialized.NotifyCollectionChangedEventArgs)
03-31 07:13:46.510 I/MonoDroid( 6386): at System.Collections.ObjectModel.ObservableCollection`1[T].OnCollectionChanged (System.Collections.Specialized.NotifyCollectionChangedEventArgs e) [0x00018] in <581a01d04fd142f28a938a6381816b26>:0
03-31 07:13:46.510 I/MonoDroid( 6386): at System.Collections.ObjectModel.ObservableCollection`1[T].OnCollectionChanged (System.Collections.Specialized.NotifyCollectionChangedAction action, System.Object item, System.Int32 index) [0x00009] in <581a01d04fd142f28a938a6381816b26>:0
03-31 07:13:46.510 I/MonoDroid( 6386): at System.Collections.ObjectModel.ObservableCollection`1[T].InsertItem (System.Int32 index, T item) [0x0001a] in <581a01d04fd142f28a938a6381816b26>:0
03-31 07:13:46.510 I/MonoDroid( 6386): at System.Collections.ObjectModel.Collection`1[T].Insert (System.Int32 index, T item) [0x00027] in <629bcb146d674f9e83b55f4a64e6918c>:0
03-31 07:13:46.510 I/MonoDroid( 6386): at Xamarin.Forms.ObservableWrapper`2[TTrack,TRestrict].Insert (System.Int32 index, TRestrict item) [0x0003f] in <b5f62705a3ea4249ac22723294e68624>:0
03-31 07:13:46.510 I/MonoDroid( 6386): at UXDivers.Grial.FixedSizeLayout.UpdateVisibleItems () [0x0012e] in <70947e6eb6c44297aac214af99a22940>:0
03-31 07:13:46.510 I/MonoDroid( 6386): at UXDivers.Grial.FixedSizeLayout.SetViewPort (System.Double center, System.Double radius) [0x00015] in <70947e6eb6c44297aac214af99a22940>:0
03-31 07:13:46.510 I/MonoDroid( 6386): at UXDivers.Grial.Repeater.UpdateViewport (System.Double width, System.Double height, System.Double scrollPosition) [0x00048] in <70947e6eb6c44297aac214af99a22940>:0
03-31 07:13:46.510 I/MonoDroid( 6386): at UXDivers.Grial.Repeater.LayoutChildren (System.Double x, System.Double y, System.Double width, System.Double height) [0x00144] in <70947e6eb6c44297aac214af99a22940>:0
03-31 07:13:46.510 I/MonoDroid( 6386): at System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.<ThrowAsync>b__7_0 (System.Object state) [0x00000] in <629bcb146d674f9e83b55f4a64e6918c>:0
03-31 07:13:46.510 I/MonoDroid( 6386): at Android.App.SyncContext+<>c__DisplayClass2_0.<Post>b__0 () [0x00000] in <bbfb9f1091004c048ef9a9c1f37af2d0>:0
03-31 07:13:46.510 I/MonoDroid( 6386): at Java.Lang.Thread+RunnableImplementor.Run () [0x00008] in <bbfb9f1091004c048ef9a9c1f37af2d0>:0
03-31 07:13:46.510 I/MonoDroid( 6386): at Java.Lang.IRunnableInvoker.n_Run (System.IntPtr jnienv, System.IntPtr native__this) [0x00008] in <bbfb9f1091004c048ef9a9c1f37af2d0>:0
03-31 07:13:46.510 I/MonoDroid( 6386): at (wrapper dynamic-method) Android.Runtime.DynamicMethodNameCounter.46(intptr,intptr)
Goes without saying that this is a major issue as it breaks Android as a whole. Thanks.
@Tommigun1980 Are you setting the experimental flags somewhere else in the App? If not, could you attach a small example?
@Tommigun1980 Do you still have this issue?, are you setting the experimental flags somewhere else in the App? If not, could you attach a small example?
Hi.
Having a swipe view in your form breaks the designer with the error
being displayed in the visualisation area, after loading the previewer for a very long time. Expected behaviour would be that it would visualise the swipe view's content.
Reproducible with the following snippet:
I have only tested this in iOS mode, don't know if it happens in Android mode as well. I'm using the latest preview version 4.6.0.494-pre2.