AndreiMisiukevich / TouchEffect

UI-responsive touch effects for Xamarin.Forms
MIT License
195 stars 33 forks source link

NullReferenceException inside a Frame #47

Closed ivanjx closed 4 years ago

ivanjx commented 4 years ago

Hi,

I tried to use this library, mainly to enable native animation for each platform. Everything seems to work as expected but i cant get it working with Frame control and keep getting NullReferenceException. Here is my code:

 <!-- Content -->
            <StackLayout
                Grid.Row="1">
                <Frame
                    Margin="20"
                    HasShadow="True"
                    IsClippedToBounds="True"
                    CornerRadius="5"
                    touch:TouchEff.NativeAnimation="True">
                    <Frame.Effects>
                        <touch:TouchEff/>
                    </Frame.Effects>

                    <StackLayout>
                        <Label
                            Text="Header"
                            FontSize="Medium"
                            Margin="0,0,0,10"/>

                        <Grid
                            Grid.Row="1">

                        </Grid>
                    </StackLayout>
                </Frame>
            </StackLayout>

And here is the stacktrace:

  at TouchEffect.Android.PlatformTouchEff.OnAttached () [0x000a2] in <af36e72ba61f4748b6fedd0a51809462>:0 
  at Xamarin.Forms.Effect.SendAttached () [0x00009] in D:\a\1\s\Xamarin.Forms.Core\Effect.cs:54 
  at Xamarin.Forms.RoutingEffect.SendAttached () [0x00000] in D:\a\1\s\Xamarin.Forms.Core\RoutingEffect.cs:29 
  at Xamarin.Forms.Element.AttachEffect (Xamarin.Forms.Effect effect) [0x00045] in D:\a\1\s\Xamarin.Forms.Core\Element.cs:538 
  at Xamarin.Forms.Element.set_EffectControlProvider (Xamarin.Forms.IEffectControlProvider value) [0x0007c] in D:\a\1\s\Xamarin.Forms.Core\Element.cs:240 
  at Xamarin.Forms.Internals.EffectUtilities.RegisterEffectControlProvider (Xamarin.Forms.IEffectControlProvider self, Xamarin.Forms.IElementController oldElement, Xamarin.Forms.IElementController newElement) [0x0001a] in D:\a\1\s\Xamarin.Forms.Core\Internals\EffectUtilities.cs:16 
  at Xamarin.Forms.Platform.Android.FastRenderers.VisualElementRenderer.OnElementChanged (System.Object sender, Xamarin.Forms.Platform.Android.VisualElementChangedEventArgs e) [0x0005c] in D:\a\1\s\Xamarin.Forms.Platform.Android\FastRenderers\VisualElementRenderer.cs:102 
  at (wrapper delegate-invoke) System.EventHandler`1[Xamarin.Forms.Platform.Android.VisualElementChangedEventArgs].invoke_void_object_TEventArgs(object,Xamarin.Forms.Platform.Android.VisualElementChangedEventArgs)
  at Xamarin.Forms.Platform.Android.FastRenderers.FrameRenderer.OnElementChanged (Xamarin.Forms.Platform.Android.ElementChangedEventArgs`1[TElement] e) [0x00000] in D:\a\1\s\Xamarin.Forms.Platform.Android\FastRenderers\FrameRenderer.cs:171 
  at Xamarin.Forms.Platform.Android.FastRenderers.FrameRenderer.set_Element (Xamarin.Forms.Frame value) [0x00018] in D:\a\1\s\Xamarin.Forms.Platform.Android\FastRenderers\FrameRenderer.cs:65 
  at Xamarin.Forms.Platform.Android.FastRenderers.FrameRenderer.Xamarin.Forms.Platform.Android.IVisualElementRenderer.SetElement (Xamarin.Forms.VisualElement element) [0x00015] in D:\a\1\s\Xamarin.Forms.Platform.Android\FastRenderers\FrameRenderer.cs:86 
  at Xamarin.Forms.Platform.Android.Platform.CreateRenderer (Xamarin.Forms.VisualElement element, Android.Content.Context context) [0x0001f] in D:\a\1\s\Xamarin.Forms.Platform.Android\Platform.cs:350 
  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) [0x000af] in D:\a\1\s\Xamarin.Forms.Platform.Android\VisualElementPackager.cs:137 
  at Xamarin.Forms.Platform.Android.VisualElementPackager.SetElement (Xamarin.Forms.VisualElement oldElement, Xamarin.Forms.VisualElement newElement) [0x00163] in D:\a\1\s\Xamarin.Forms.Platform.Android\VisualElementPackager.cs:347 
  at Xamarin.Forms.Platform.Android.VisualElementPackager.Load () [0x00000] in D:\a\1\s\Xamarin.Forms.Platform.Android\VisualElementPackager.cs:109 
  at Xamarin.Forms.Platform.Android.VisualElementRenderer`1[TElement].SetPackager (Xamarin.Forms.Platform.Android.VisualElementPackager packager) [0x00007] in D:\a\1\s\Xamarin.Forms.Platform.Android\VisualElementRenderer.cs:449 
  at Xamarin.Forms.Platform.Android.VisualElementRenderer`1[TElement].SetElement (TElement element) [0x000d5] in D:\a\1\s\Xamarin.Forms.Platform.Android\VisualElementRenderer.cs:243 
  at Xamarin.Forms.Platform.Android.VisualElementRenderer`1[TElement].Xamarin.Forms.Platform.Android.IVisualElementRenderer.SetElement (Xamarin.Forms.VisualElement element) [0x00033] in D:\a\1\s\Xamarin.Forms.Platform.Android\VisualElementRenderer.cs:133 
  at Xamarin.Forms.Platform.Android.Platform.CreateRenderer (Xamarin.Forms.VisualElement element, Android.Content.Context context) [0x0001f] in D:\a\1\s\Xamarin.Forms.Platform.Android\Platform.cs:350 
  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) [0x000af] in D:\a\1\s\Xamarin.Forms.Platform.Android\VisualElementPackager.cs:137 
  at Xamarin.Forms.Platform.Android.VisualElementPackager.SetElement (Xamarin.Forms.VisualElement oldElement, Xamarin.Forms.VisualElement newElement) [0x00163] in D:\a\1\s\Xamarin.Forms.Platform.Android\VisualElementPackager.cs:347 
  at Xamarin.Forms.Platform.Android.VisualElementPackager.Load () [0x00000] in D:\a\1\s\Xamarin.Forms.Platform.Android\VisualElementPackager.cs:109 
  at Xamarin.Forms.Platform.Android.VisualElementRenderer`1[TElement].SetPackager (Xamarin.Forms.Platform.Android.VisualElementPackager packager) [0x00007] in D:\a\1\s\Xamarin.Forms.Platform.Android\VisualElementRenderer.cs:449 
  at Xamarin.Forms.Platform.Android.VisualElementRenderer`1[TElement].SetElement (TElement element) [0x000d5] in D:\a\1\s\Xamarin.Forms.Platform.Android\VisualElementRenderer.cs:243 
  at Xamarin.Forms.Platform.Android.VisualElementRenderer`1[TElement].Xamarin.Forms.Platform.Android.IVisualElementRenderer.SetElement (Xamarin.Forms.VisualElement element) [0x00033] in D:\a\1\s\Xamarin.Forms.Platform.Android\VisualElementRenderer.cs:133 
  at Xamarin.Forms.Platform.Android.Platform.CreateRenderer (Xamarin.Forms.VisualElement element, Android.Content.Context context) [0x0001f] in D:\a\1\s\Xamarin.Forms.Platform.Android\Platform.cs:350 
  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) [0x000af] in D:\a\1\s\Xamarin.Forms.Platform.Android\VisualElementPackager.cs:137 
  at Xamarin.Forms.Platform.Android.VisualElementPackager.SetElement (Xamarin.Forms.VisualElement oldElement, Xamarin.Forms.VisualElement newElement) [0x00163] in D:\a\1\s\Xamarin.Forms.Platform.Android\VisualElementPackager.cs:347 
  at Xamarin.Forms.Platform.Android.VisualElementPackager.Load () [0x00000] in D:\a\1\s\Xamarin.Forms.Platform.Android\VisualElementPackager.cs:109 
  at Xamarin.Forms.Platform.Android.VisualElementRenderer`1[TElement].SetPackager (Xamarin.Forms.Platform.Android.VisualElementPackager packager) [0x00007] in D:\a\1\s\Xamarin.Forms.Platform.Android\VisualElementRenderer.cs:449 
  at Xamarin.Forms.Platform.Android.VisualElementRenderer`1[TElement].SetElement (TElement element) [0x000d5] in D:\a\1\s\Xamarin.Forms.Platform.Android\VisualElementRenderer.cs:243 
  at Xamarin.Forms.Platform.Android.VisualElementRenderer`1[TElement].Xamarin.Forms.Platform.Android.IVisualElementRenderer.SetElement (Xamarin.Forms.VisualElement element) [0x00033] in D:\a\1\s\Xamarin.Forms.Platform.Android\VisualElementRenderer.cs:133 
  at Xamarin.Forms.Platform.Android.Platform.CreateRenderer (Xamarin.Forms.VisualElement element, Android.Content.Context context) [0x0001f] in D:\a\1\s\Xamarin.Forms.Platform.Android\Platform.cs:350 
  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) [0x000af] in D:\a\1\s\Xamarin.Forms.Platform.Android\VisualElementPackager.cs:137 
  at Xamarin.Forms.Platform.Android.VisualElementPackager.SetElement (Xamarin.Forms.VisualElement oldElement, Xamarin.Forms.VisualElement newElement) [0x00163] in D:\a\1\s\Xamarin.Forms.Platform.Android\VisualElementPackager.cs:347 
  at Xamarin.Forms.Platform.Android.VisualElementPackager.Load () [0x00000] in D:\a\1\s\Xamarin.Forms.Platform.Android\VisualElementPackager.cs:109 
  at Xamarin.Forms.Platform.Android.VisualElementRenderer`1[TElement].SetPackager (Xamarin.Forms.Platform.Android.VisualElementPackager packager) [0x00007] in D:\a\1\s\Xamarin.Forms.Platform.Android\VisualElementRenderer.cs:449 
  at Xamarin.Forms.Platform.Android.VisualElementRenderer`1[TElement].SetElement (TElement element) [0x000d5] in D:\a\1\s\Xamarin.Forms.Platform.Android\VisualElementRenderer.cs:243 
  at Xamarin.Forms.Platform.Android.VisualElementRenderer`1[TElement].Xamarin.Forms.Platform.Android.IVisualElementRenderer.SetElement (Xamarin.Forms.VisualElement element) [0x00033] in D:\a\1\s\Xamarin.Forms.Platform.Android\VisualElementRenderer.cs:133 
  at Xamarin.Forms.Platform.Android.Platform.CreateRenderer (Xamarin.Forms.VisualElement element, Android.Content.Context context) [0x0001f] in D:\a\1\s\Xamarin.Forms.Platform.Android\Platform.cs:350 
  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) [0x000af] in D:\a\1\s\Xamarin.Forms.Platform.Android\VisualElementPackager.cs:137 
  at Xamarin.Forms.Platform.Android.VisualElementPackager.SetElement (Xamarin.Forms.VisualElement oldElement, Xamarin.Forms.VisualElement newElement) [0x00163] in D:\a\1\s\Xamarin.Forms.Platform.Android\VisualElementPackager.cs:347 
  at Xamarin.Forms.Platform.Android.VisualElementPackager.Load () [0x00000] in D:\a\1\s\Xamarin.Forms.Platform.Android\VisualElementPackager.cs:109 
  at Xamarin.Forms.Platform.Android.VisualElementRenderer`1[TElement].SetPackager (Xamarin.Forms.Platform.Android.VisualElementPackager packager) [0x00007] in D:\a\1\s\Xamarin.Forms.Platform.Android\VisualElementRenderer.cs:449 
  at Xamarin.Forms.Platform.Android.VisualElementRenderer`1[TElement].SetElement (TElement element) [0x000d5] in D:\a\1\s\Xamarin.Forms.Platform.Android\VisualElementRenderer.cs:243 
  at Xamarin.Forms.Platform.Android.VisualElementRenderer`1[TElement].Xamarin.Forms.Platform.Android.IVisualElementRenderer.SetElement (Xamarin.Forms.VisualElement element) [0x00033] in D:\a\1\s\Xamarin.Forms.Platform.Android\VisualElementRenderer.cs:133 
  at Xamarin.Forms.Platform.Android.Platform.CreateRenderer (Xamarin.Forms.VisualElement element, Android.Content.Context context) [0x0001f] in D:\a\1\s\Xamarin.Forms.Platform.Android\Platform.cs:350 
  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) [0x000af] in D:\a\1\s\Xamarin.Forms.Platform.Android\VisualElementPackager.cs:137 
  at Xamarin.Forms.Platform.Android.VisualElementPackager.SetElement (Xamarin.Forms.VisualElement oldElement, Xamarin.Forms.VisualElement newElement) [0x00163] in D:\a\1\s\Xamarin.Forms.Platform.Android\VisualElementPackager.cs:347 
  at Xamarin.Forms.Platform.Android.VisualElementPackager.Load () [0x00000] in D:\a\1\s\Xamarin.Forms.Platform.Android\VisualElementPackager.cs:109 
  at Xamarin.Forms.Platform.Android.VisualElementRenderer`1[TElement].SetPackager (Xamarin.Forms.Platform.Android.VisualElementPackager packager) [0x00007] in D:\a\1\s\Xamarin.Forms.Platform.Android\VisualElementRenderer.cs:449 
  at Xamarin.Forms.Platform.Android.VisualElementRenderer`1[TElement].SetElement (TElement element) [0x000d5] in D:\a\1\s\Xamarin.Forms.Platform.Android\VisualElementRenderer.cs:243 
  at Xamarin.Forms.Platform.Android.VisualElementRenderer`1[TElement].Xamarin.Forms.Platform.Android.IVisualElementRenderer.SetElement (Xamarin.Forms.VisualElement element) [0x00033] in D:\a\1\s\Xamarin.Forms.Platform.Android\VisualElementRenderer.cs:133 
  at Xamarin.Forms.Platform.Android.Platform.CreateRenderer (Xamarin.Forms.VisualElement element, Android.Content.Context context) [0x0001f] in D:\a\1\s\Xamarin.Forms.Platform.Android\Platform.cs:350 
  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) [0x000af] in D:\a\1\s\Xamarin.Forms.Platform.Android\VisualElementPackager.cs:137 
  at Xamarin.Forms.Platform.Android.VisualElementPackager.SetElement (Xamarin.Forms.VisualElement oldElement, Xamarin.Forms.VisualElement newElement) [0x00163] in D:\a\1\s\Xamarin.Forms.Platform.Android\VisualElementPackager.cs:347 
  at Xamarin.Forms.Platform.Android.VisualElementPackager.Load () [0x00000] in D:\a\1\s\Xamarin.Forms.Platform.Android\VisualElementPackager.cs:109 
  at Xamarin.Forms.Platform.Android.VisualElementRenderer`1[TElement].SetPackager (Xamarin.Forms.Platform.Android.VisualElementPackager packager) [0x00007] in D:\a\1\s\Xamarin.Forms.Platform.Android\VisualElementRenderer.cs:449 
  at Xamarin.Forms.Platform.Android.VisualElementRenderer`1[TElement].SetElement (TElement element) [0x000d5] in D:\a\1\s\Xamarin.Forms.Platform.Android\VisualElementRenderer.cs:243 
  at Xamarin.Forms.Platform.Android.VisualElementRenderer`1[TElement].Xamarin.Forms.Platform.Android.IVisualElementRenderer.SetElement (Xamarin.Forms.VisualElement element) [0x00033] in D:\a\1\s\Xamarin.Forms.Platform.Android\VisualElementRenderer.cs:133 
  at Xamarin.Forms.Platform.Android.Platform.CreateRenderer (Xamarin.Forms.VisualElement element, Android.Content.Context context) [0x0001f] in D:\a\1\s\Xamarin.Forms.Platform.Android\Platform.cs:350 
  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) [0x000af] in D:\a\1\s\Xamarin.Forms.Platform.Android\VisualElementPackager.cs:137 
  at Xamarin.Forms.Platform.Android.VisualElementPackager.SetElement (Xamarin.Forms.VisualElement oldElement, Xamarin.Forms.VisualElement newElement) [0x00163] in D:\a\1\s\Xamarin.Forms.Platform.Android\VisualElementPackager.cs:347 
  at Xamarin.Forms.Platform.Android.VisualElementPackager.Load () [0x00000] in D:\a\1\s\Xamarin.Forms.Platform.Android\VisualElementPackager.cs:109 
  at Xamarin.Forms.Platform.Android.VisualElementRenderer`1[TElement].SetPackager (Xamarin.Forms.Platform.Android.VisualElementPackager packager) [0x00007] in D:\a\1\s\Xamarin.Forms.Platform.Android\VisualElementRenderer.cs:449 
  at Xamarin.Forms.Platform.Android.VisualElementRenderer`1[TElement].SetElement (TElement element) [0x000d5] in D:\a\1\s\Xamarin.Forms.Platform.Android\VisualElementRenderer.cs:243 
  at Xamarin.Forms.Platform.Android.VisualElementRenderer`1[TElement].Xamarin.Forms.Platform.Android.IVisualElementRenderer.SetElement (Xamarin.Forms.VisualElement element) [0x00033] in D:\a\1\s\Xamarin.Forms.Platform.Android\VisualElementRenderer.cs:133 
  at Xamarin.Forms.Platform.Android.Platform.CreateRenderer (Xamarin.Forms.VisualElement element, Android.Content.Context context) [0x0001f] in D:\a\1\s\Xamarin.Forms.Platform.Android\Platform.cs:350 
  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) [0x000af] in D:\a\1\s\Xamarin.Forms.Platform.Android\VisualElementPackager.cs:137 
  at Xamarin.Forms.Platform.Android.VisualElementPackager.SetElement (Xamarin.Forms.VisualElement oldElement, Xamarin.Forms.VisualElement newElement) [0x00163] in D:\a\1\s\Xamarin.Forms.Platform.Android\VisualElementPackager.cs:347 
  at Xamarin.Forms.Platform.Android.VisualElementPackager.Load () [0x00000] in D:\a\1\s\Xamarin.Forms.Platform.Android\VisualElementPackager.cs:109 
  at Xamarin.Forms.Platform.Android.VisualElementRenderer`1[TElement].SetPackager (Xamarin.Forms.Platform.Android.VisualElementPackager packager) [0x00007] in D:\a\1\s\Xamarin.Forms.Platform.Android\VisualElementRenderer.cs:449 
  at Xamarin.Forms.Platform.Android.VisualElementRenderer`1[TElement].SetElement (TElement element) [0x000d5] in D:\a\1\s\Xamarin.Forms.Platform.Android\VisualElementRenderer.cs:243 
  at Xamarin.Forms.Platform.Android.VisualElementRenderer`1[TElement].Xamarin.Forms.Platform.Android.IVisualElementRenderer.SetElement (Xamarin.Forms.VisualElement element) [0x00033] in D:\a\1\s\Xamarin.Forms.Platform.Android\VisualElementRenderer.cs:133 
  at Xamarin.Forms.Platform.Android.Platform.CreateRenderer (Xamarin.Forms.VisualElement element, Android.Content.Context context) [0x0001f] in D:\a\1\s\Xamarin.Forms.Platform.Android\Platform.cs:350 
  at Xamarin.Forms.Platform.Android.AppCompat.Platform.AddChild (Xamarin.Forms.Page page, System.Boolean layout) [0x0000d] in D:\a\1\s\Xamarin.Forms.Platform.Android\AppCompat\Platform.cs:379 
  at Xamarin.Forms.Platform.Android.AppCompat.Platform.SetPageInternal (Xamarin.Forms.Page newRoot) [0x0005a] in D:\a\1\s\Xamarin.Forms.Platform.Android\AppCompat\Platform.cs:337 
  at Xamarin.Forms.Platform.Android.AppCompat.Platform.SetPage (Xamarin.Forms.Page newRoot) [0x000e6] in D:\a\1\s\Xamarin.Forms.Platform.Android\AppCompat\Platform.cs:291 
  at Xamarin.Forms.Platform.Android.FormsAppCompatActivity.InternalSetPage (Xamarin.Forms.Page page) [0x00039] in D:\a\1\s\Xamarin.Forms.Platform.Android\AppCompat\FormsAppCompatActivity.cs:515 
  at Xamarin.Forms.Platform.Android.FormsAppCompatActivity.SetMainPage () [0x00000] in D:\a\1\s\Xamarin.Forms.Platform.Android\AppCompat\FormsAppCompatActivity.cs:541 
  at Xamarin.Forms.Platform.Android.FormsAppCompatActivity.LoadApplication (Xamarin.Forms.Application application) [0x00140] in D:\a\1\s\Xamarin.Forms.Platform.Android\AppCompat\FormsAppCompatActivity.cs:191 
  at home_server.Client.XPlat.Droid.MainActivity.OnCreate (Android.OS.Bundle savedInstanceState) [0x0004a] in C:\Users\Ivan Kara\Documents\projects\home-server\home-server.Client.XPlat\home-server.Client.XPlat.Android\MainActivity.cs:38 
  at Android.App.Activity.n_OnCreate_Landroid_os_Bundle_ (System.IntPtr jnienv, System.IntPtr native__this, System.IntPtr native_savedInstanceState) [0x00011] in <d3b924763d4a465c85b26f6e8edc8a53>:0 
  at (wrapper dynamic-method) Android.Runtime.DynamicMethodNameCounter.4(intptr,intptr,intptr)

Any help would be appreciated.

Nuget version: v4.1.30

AndreiMisiukevich commented 4 years ago

Hi mate) What xamarin.forms version do you use?

Because I fixed this bug in Xamarin.Forms repository

https://github.com/xamarin/Xamarin.Forms/pull/6412

Try latest XF version, this bug should go

ivanjx commented 4 years ago

This https://www.nuget.org/packages/Xamarin.Forms/4.5.0.617

AndreiMisiukevich commented 4 years ago

@realivanjx reproduced. Checking it

AndreiMisiukevich commented 4 years ago

Try latest version

ivanjx commented 4 years ago

Thank you