Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 91519

Animation causing KeyNotFoundException: The given key was not present in the dictionary.

$
0
0

So I have pretty consistently had issues calling animations from non ui-threads generating this exception.

{System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.
at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
at Xamarin.Forms.AnimationExtensions.HandleTweenerUpdated(Object o, EventArgs args)
at Xamarin.Forms.Tweener.b__0(Int64 step)
at Xamarin.Forms.Ticker.SendSignals(Int32 timestep)
at Xamarin.Forms.WinPhoneTicker.<.ctor>b__1(Object sender, EventArgs args)
at MS.Internal.CoreInvokeHandler.InvokeEventHandler(Int32 typeIndex, Delegate handlerDelegate, Object sender, Object args)
at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, Int32 actualArgsTypeIndex, String eventName)}

It happens every time when I do this on WinPhone:

var gesture = new TapGestureRecognizer
            {
                Command = new Command((x) =>
                {
                    if (Command.CanExecute(null) && IsEnabled)
                    {
                        Device.BeginInvokeOnMainThread(new Action(async () =>
                        {
                            await this.ScaleTo(.85, 75, Easing.CubicOut);
                            this.ScaleTo(1, 75, Easing.CubicIn);
                        }));
                        Command.Execute(CommandParameter);
                    }
                }),
                NumberOfTapsRequired = 1
            };

It works fine on Android and iOS. Has anyone else ran into this?``


Viewing all articles
Browse latest Browse all 91519

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>