NullReferenceException Xamarin.Forms.Platform.iOS.StructuredItemsViewRenderer [Bug] #8715
Comments
Reminds on this issue 5161 |
Unfortunately we need to have multiple FlyoutItems in AppShell because we use it only for navigation drawer (hamburger), no bottom tabs, and when we have more then 5 menu items in a FlyoutItem, the styling of the appbar/toolbar is broken for the pages 6+ on iOS |
How collection view item template looks like:
<CollectionView.ItemTemplate>
|
While I understand you might not have the time, I hope you understand that this will probably also mean that we won't be able to solve this any time soon. Having a reproduction will greatly help us identify and solve the problem. |
demo xamarin forms project |
iPhone 11 Pro Max iOS 13.2 2019-12-03 10-12-16.mp4.zip Video of reproduction steps
|
I checked now and it seems that ListView doesn't have this problem, only CollectionView |
@jfversluis How soon can it be solved and released? So we know whether to revert to alternatives. We have a deployment rather soon. |
Originates from this line: Xamarin.Forms/Xamarin.Forms.Platform.iOS/CollectionView/StructuredItemsViewRenderer.cs Line 81 in 87d720c
Where Steps:
Just iOS, Android is all fine and still happening in latest nightly.
|
I am having this same issue! |
Same issue. I am trying to use the Collection View inside ContentView. Works fine in Android. In iOS it is throwing NullReferenceException. Here's the ST: " at Xamarin.Forms.Platform.iOS.StructuredItemsViewRenderer |
Same issue here! Android is working, but IOS No. XAML
C# var font = Device.RuntimePlatform == Device.Android ? "SegMDL2.ttf#Segoe MDL2 Assets" : "Segoe MDL2 Assets"; FlyoutItemMain.Items.Add(new ShellContent FlyoutItemReport.Items.Add(new ShellContent |
The problem is in any page shell that I call MainPage. If I call a ContentPage it works! === Visual Studio Professional 2019 for Mac === Version 8.4.5 (build 19)
=== Mono Framework MDK === Runtime: === Roslyn (Language Service) === 3.4.0-beta4-19562-05+ff930dec4565e2bc424ad3bf3e22ecb20542c87d === NuGet === Version: 5.3.0.6192 === .NET Core SDK === SDK: /usr/local/share/dotnet/sdk/3.1.101/Sdks === .NET Core Runtime === Runtime: /usr/local/share/dotnet/dotnet === Xamarin.Profiler === Version: 1.6.12.29 === Updater === Version: 11 === Apple Developer Tools === Xcode 11.3.1 (15715) === Xamarin.Mac === Version: 6.10.0.17 (Visual Studio Professional) === Xamarin.iOS === Version: 13.10.0.17 (Visual Studio Professional) === Xamarin Designer === Version: 16.4.0.479 === Xamarin.Android === Version: 10.1.3.7 (Visual Studio Professional) SDK Tools Version: 26.1.1 Build Information: === Microsoft Mobile OpenJDK === Java SDK: /Users/devprime/Library/Developer/Xamarin/jdk/microsoft_dist_openjdk_1.8.0.25 === Android SDK Manager === Version: 16.4.0.10 === Android Device Manager === Version: 16.4.0.30 === Xamarin Inspector === Version: 1.4.3 === Build Information === Release ID: 804050019 === Operating System === Mac OS X 10.15.2 |
This happened for me when transitioning from one page containing a collection view to a different page. Before the 2nd page is requested, I need to hide the collection view (IsVisible=false) to prevent a weird flash I was seeing. However, the collection view remained hidden after transitioning to the 2nd page, and when I went back to the 1st page (that has the collection view), I get the error. I was able to fix this by sending a message from page 2 to page 1 telling page 1 to 'show' the collection view (IsVisible=true). Once I had that in place, the error went away. For my case, if the collection view is hidden prior to navigating away, when you go back to that page, the error is immediately thrown. Doesn't matter if you try to show the collection view in page 1's OnAppearing method. Hopefully this helps someone else? |
Xamarin Forms 4.4.0.991210-pre2
IPhone 7, iOS v13.1.3
NullReferenceException
at Xamarin.Forms.Platform.iOS.StructuredItemsViewRenderer
have a lot of IsVisible Bindings and other bindings in my XAML
in XAML you can mainly find two CollectionViews, StackLayout, FlexButtons
It is reproducible when one of the CollectionViews visibility changes from hidden to IsVisible and back to hidden, and then in my shell navigating to an entry in another FlyoutItem and then back to original FlyoutItem entry. So keep in mind only when switching from menu entries in different FlyoutItems
Strangely if I just switch from menu entries in the same FlyoutItem the exception doesn't occur.
Unfortunately can not provide an example code in quick notice.
Full stack trace:
at Xamarin.Forms.Platform.iOS.StructuredItemsViewRenderer2[TItemsView,TViewController].LayoutSubviews () [0x0000c] in <4f759157e6f148a992d3fa3b90518ad0>:0 at (wrapper managed-to-native) ObjCRuntime.Messaging.void_objc_msgSend(intptr,intptr) at CoreAnimation.CALayer.LayoutSublayers () [0x00008] in /Library/Frameworks/Xamarin.iOS.framework/Versions/13.6.0.12/src/Xamarin.iOS/CALayer.g.cs:508 at Xamarin.Forms.Platform.iOS.VisualElementTracker+<>c__DisplayClass29_0.g__update|0 () [0x00162] in D:\a\1\s\Xamarin.Forms.Platform.iOS\VisualElementTracker.cs:252 at Xamarin.Forms.Platform.iOS.VisualElementTracker.OnUpdateNativeControl (CoreAnimation.CALayer caLayer) [0x002be] in D:\a\1\s\Xamarin.Forms.Platform.iOS\VisualElementTracker.cs:324 at Xamarin.Forms.Platform.iOS.VisualElementTracker.UpdateNativeControl () [0x00060] in D:\a\1\s\Xamarin.Forms.Platform.iOS\VisualElementTracker.cs:376 at Xamarin.Forms.Platform.iOS.VisualElementTracker.SetElement (Xamarin.Forms.VisualElement oldElement, Xamarin.Forms.VisualElement newElement) [0x00055] in D:\a\1\s\Xamarin.Forms.Platform.iOS\VisualElementTracker.cs:352 at Xamarin.Forms.Platform.iOS.VisualElementTracker..ctor (Xamarin.Forms.Platform.iOS.IVisualElementRenderer renderer, System.Boolean trackFrame) [0x0006b] in D:\a\1\s\Xamarin.Forms.Platform.iOS\VisualElementTracker.cs:50 at Xamarin.Forms.Platform.iOS.VisualElementTracker..ctor (Xamarin.Forms.Platform.iOS.IVisualElementRenderer renderer) [0x00000] in D:\a\1\s\Xamarin.Forms.Platform.iOS\VisualElementTracker.cs:36 at Xamarin.Forms.Platform.iOS.VisualElementRenderer1[TElement].SetElement (TElement element) [0x0009f] in <4f759157e6f148a992d3fa3b90518ad0>:0
at Xamarin.Forms.Platform.iOS.VisualElementRenderer1[TElement].Xamarin.Forms.Platform.iOS.IVisualElementRenderer.SetElement (Xamarin.Forms.VisualElement element) [0x00000] in <4f759157e6f148a992d3fa3b90518ad0>:0 at Xamarin.Forms.Platform.iOS.Platform.CreateRenderer (Xamarin.Forms.VisualElement element) [0x00014] in D:\a\1\s\Xamarin.Forms.Platform.iOS\Platform.cs:188 at Xamarin.Forms.Platform.iOS.VisualElementPackager.OnChildAdded (Xamarin.Forms.VisualElement view) [0x0003e] in D:\a\1\s\Xamarin.Forms.Platform.iOS\VisualElementPackager.cs:99 at Xamarin.Forms.Platform.iOS.VisualElementPackager.Load () [0x0001e] in D:\a\1\s\Xamarin.Forms.Platform.iOS\VisualElementPackager.cs:48 at Xamarin.Forms.Platform.iOS.VisualElementRenderer1[TElement].SetElement (TElement element) [0x000de] in <4f759157e6f148a992d3fa3b90518ad0>:0
at Xamarin.Forms.Platform.iOS.VisualElementRenderer`1[TElement].Xamarin.Forms.Platform.iOS.IVisualElementRenderer.SetElement (Xamarin.Forms.VisualElement element) [0x00000] in <4f759157e6f148a992d3fa3b90518ad0>:0
at Xamarin.Forms.Platform.iOS.Platform.CreateRenderer (Xamarin.Forms.VisualElement element) [0x00014] in D:\a\1\s\Xamarin.Forms.Platform.iOS\Platform.cs:188
at Xamarin.Forms.Platform.iOS.VisualElementPackager.OnChildAdded (Xamarin.Forms.VisualElement view) [0x0003e] in D:\a\1\s\Xamarin.Forms.Platform.iOS\VisualElementPackager.cs:99
at Xamarin.Forms.Platform.iOS.VisualElementPackager.Load () [0x0001e] in D:\a\1\s\Xamarin.Forms.Platform.iOS\VisualElementPackager.cs:48
at Xamarin.Forms.Platform.iOS.PageRenderer.ViewDidLoad () [0x0008f] in D:\a\1\s\Xamarin.Forms.Platform.iOS\Renderers\PageRenderer.cs:238
at (wrapper managed-to-native) ObjCRuntime.Messaging.IntPtr_objc_msgSendSuper(intptr,intptr)
at UIKit.UIViewController.get_View () [0x0002a] in /Library/Frameworks/Xamarin.iOS.framework/Versions/13.6.0.12/src/Xamarin.iOS/UIViewController.g.cs:3171
at Xamarin.Forms.Platform.iOS.PageRenderer.get_NativeView () [0x00000] in D:\a\1\s\Xamarin.Forms.Platform.iOS\Renderers\PageRenderer.cs:104
at Xamarin.Forms.Platform.iOS.PageRenderer.SetElement (Xamarin.Forms.VisualElement element) [0x0003d] in D:\a\1\s\Xamarin.Forms.Platform.iOS\Renderers\PageRenderer.cs:120
at Xamarin.Forms.Platform.iOS.Platform.CreateRenderer (Xamarin.Forms.VisualElement element) [0x00014] in D:\a\1\s\Xamarin.Forms.Platform.iOS\Platform.cs:188
at Xamarin.Forms.Platform.iOS.ShellSectionRootRenderer.LoadRenderers () [0x00028] in D:\a\1\s\Xamarin.Forms.Platform.iOS\Renderers\ShellSectionRootRenderer.cs:146
at Xamarin.Forms.Platform.iOS.ShellSectionRootRenderer.ViewDidLoad () [0x00035] in D:\a\1\s\Xamarin.Forms.Platform.iOS\Renderers\ShellSectionRootRenderer.cs:63
at (wrapper managed-to-native) UIKit.UIApplication.UIApplicationMain(int,string[],intptr,intptr)
The text was updated successfully, but these errors were encountered: