Skip to content

App crash using Sharknado tabs with Xamarin Shell #57

@stackunderflows

Description

@stackunderflows

Platform (please complete the following information):

  • OS: Both
  • Device: Pixel 2 XL emulator, iPhone Xr emulator
  • Sdk vervion: iOS 12.2, Android 8.1
  • Xamarin.Forms: 4.0

Describe the bug
I created a new Xamarin Forms Shell app. In the shell, I specified a flyout menu. I defaulted the first page to just have a label on it. Another page in the flyout has Sharknado tabs at the top of it.

To Reproduce
Steps to reproduce the behavior:

  1. Launch the app. You're brought to a page that just has a label on it because it is specified first in the shell.
  2. Click on the hamburger menu and navigate to the page that has tabs on it.
  3. Click on the hamburger menu again and navigate to a page that doesn't have tabs on it.
  4. App crashes.

Exceptions (if applicable)

Unhandled Exception:
System.ArgumentNullException: Value cannot be null.
Parameter name: key
  at System.Collections.Generic.Dictionary`2[TKey,TValue].FindEntry (TKey key) [0x00008] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.8.0.2/src/Xamarin.iOS/external/corefx/src/Common/src/CoreLib/System/Collections/Generic/Dictionary.cs:380 
  at System.Collections.Generic.Dictionary`2[TKey,TValue].ContainsKey (TKey key) [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.8.0.2/src/Xamarin.iOS/external/corefx/src/Common/src/CoreLib/System/Collections/Generic/Dictionary.cs:286 
  at Sharpnado.Presentation.Forms.iOS.Effects.TapGestureCollector.Delete (UIKit.UIView view, System.Action action) [0x00001] in /Users/mrampanelli/Projects/Sharpnado.Presentation.Forms/Sharpnado.Presentation.Forms.iOS/Effects/TapGestureCollector.cs:49 
  at Sharpnado.Presentation.Forms.iOS.Effects.iOSViewStyleEffect.OnDetached () [0x0004b] in /Users/mrampanelli/Projects/Sharpnado.Presentation.Forms/Sharpnado.Presentation.Forms.iOS/Effects/ViewStyleEffect .cs:67 
  at Xamarin.Forms.Effect.SendDetached () [0x00009] in D:\a\1\s\Xamarin.Forms.Core\Effect.cs:62 
  at Xamarin.Forms.PlatformEffect`2[TContainer,TControl].SendDetached () [0x00000] in D:\a\1\s\Xamarin.Forms.Core\PlatformEffect.cs:23 
  at Xamarin.Forms.RoutingEffect.SendDetached () [0x00000] in D:\a\1\s\Xamarin.Forms.Core\RoutingEffect.cs:34 
...

I downloaded the Sharknado code and figured out the problem. In 2 places, the view variable is coming through as null. In TapGestureRecognizerCollector Delete method and LongTapGestureCollector Delete method. Adding a null check fixes the problem.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions