xamarin / Xamarin.Forms

Xamarin.Forms is no longer supported. Migrate your apps to .NET MAUI.
https://aka.ms/xamarin-upgrade
Other
5.62k stars 1.87k forks source link

[Bug] System.InvalidCastException: Specified cast is not valid. at Xamarin.Forms.View.get_Margin () [0x00000] in D:\a\1\s\Xamarin.Forms.Core\View.cs:145 #14987

Open ems107 opened 2 years ago

ems107 commented 2 years ago

Description

I have view with huge xaml, there, I have a collectionview , if I enter to that view and I mess around some time with the scroll, then go back and go forward some times (some times not, is a bit random but it happens) I get this exception on Page.OnSizeAllocated

this is the full exception: {System.InvalidCastException: Specified cast is not valid. at Xamarin.Forms.View.get_Margin () [0x00000] in D:\a\1\s\Xamarin.Forms.Core\View.cs:145 at Xamarin.Forms.VisualElement.Measure (System.Double widthConstraint, System.Double heightConstraint, Xamarin.Forms.MeasureFlags flags) [0x0001b] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:794 at Xamarin.Forms.Grid+GridStructure.MeasuredStarredColumns (Xamarin.Forms.Grid grid, System.Double widthConstraint, System.Double heightConstraint, System.Double totalStarsWidth) [0x000da] in D:\a\1\s\Xamarin.Forms.Core\GridCalc.cs:670 at Xamarin.Forms.Grid+GridStructure.MeasureAndContractStarredColumns (Xamarin.Forms.Grid grid, System.Double width, System.Double height, System.Double totalStarsWidth) [0x0000e] in D:\a\1\s\Xamarin.Forms.Core\GridCalc.cs:588 at Xamarin.Forms.Grid+GridStructure..ctor (Xamarin.Forms.Grid grid, System.Double width, System.Double height, System.Boolean requestSize) [0x000ee] in D:\a\1\s\Xamarin.Forms.Core\GridCalc.cs:136 at Xamarin.Forms.Grid.OnSizeRequest (System.Double widthConstraint, System.Double heightConstraint) [0x0002a] in D:\a\1\s\Xamarin.Forms.Core\GridCalc.cs:55 at Xamarin.Forms.VisualElement.OnMeasure (System.Double widthConstraint, System.Double heightConstraint) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:858 at Xamarin.Forms.VisualElement.GetSizeRequest (System.Double widthConstraint, System.Double heightConstraint) [0x00053] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:747 at Xamarin.Forms.Layout.GetSizeRequest (System.Double widthConstraint, System.Double heightConstraint) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\Layout.cs:113 at Xamarin.Forms.VisualElement.Measure (System.Double widthConstraint, System.Double heightConstraint, Xamarin.Forms.MeasureFlags flags) [0x00054] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:799 at Xamarin.Forms.Grid+GridStructure.MeasureStarredRows (Xamarin.Forms.Grid grid, System.Double widthConstraint, System.Double heightConstraint, System.Double totalStarsHeight) [0x000da] in D:\a\1\s\Xamarin.Forms.Core\GridCalc.cs:731 at Xamarin.Forms.Grid+GridStructure.MeasureAndContractStarredRows (Xamarin.Forms.Grid grid, System.Double width, System.Double height, System.Double totalStarsHeight) [0x0000e] in D:\a\1\s\Xamarin.Forms.Core\GridCalc.cs:619 at Xamarin.Forms.Grid+GridStructure..ctor (Xamarin.Forms.Grid grid, System.Double width, System.Double height, System.Boolean requestSize) [0x000f8] in D:\a\1\s\Xamarin.Forms.Core\GridCalc.cs:137 at Xamarin.Forms.Grid.OnSizeRequest (System.Double widthConstraint, System.Double heightConstraint) [0x0002a] in D:\a\1\s\Xamarin.Forms.Core\GridCalc.cs:55 at Xamarin.Forms.VisualElement.OnMeasure (System.Double widthConstraint, System.Double heightConstraint) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:858 at Xamarin.Forms.VisualElement.GetSizeRequest (System.Double widthConstraint, System.Double heightConstraint) [0x00053] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:747 at Xamarin.Forms.Layout.GetSizeRequest (System.Double widthConstraint, System.Double heightConstraint) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\Layout.cs:113 at Xamarin.Forms.VisualElement.Measure (System.Double widthConstraint, System.Double heightConstraint, Xamarin.Forms.MeasureFlags flags) [0x00054] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:799 at Xamarin.Forms.Layout.LayoutChildIntoBoundingRegion (Xamarin.Forms.VisualElement child, Xamarin.Forms.Rectangle region) [0x0007b] in D:\a\1\s\Xamarin.Forms.Core\Layout.cs:133 at Xamarin.Forms.TemplatedView.LayoutChildren (System.Double x, System.Double y, System.Double width, System.Double height) [0x00019] in D:\a\1\s\Xamarin.Forms.Core\TemplatedView.cs:29 at Xamarin.Forms.Layout.UpdateChildrenLayout () [0x00158] in D:\a\1\s\Xamarin.Forms.Core\Layout.cs:239 at Xamarin.Forms.Layout.OnSizeAllocated (System.Double width, System.Double height) [0x0000f] in D:\a\1\s\Xamarin.Forms.Core\Layout.cs:203 at Xamarin.Forms.VisualElement.SizeAllocated (System.Double width, System.Double height) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:876 at Xamarin.Forms.VisualElement.SetSize (System.Double width, System.Double height) [0x00021] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:1108 at Xamarin.Forms.VisualElement.set_Bounds (Xamarin.Forms.Rectangle value) [0x0005d] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:415 at Xamarin.Forms.VisualElement.Layout (Xamarin.Forms.Rectangle bounds) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:785 at Xamarin.Forms.Layout.LayoutChildIntoBoundingRegion (Xamarin.Forms.VisualElement child, Xamarin.Forms.Rectangle region) [0x001da] in D:\a\1\s\Xamarin.Forms.Core\Layout.cs:157 at Xamarin.Forms.Grid.LayoutChildren (System.Double x, System.Double y, System.Double width, System.Double height) [0x00150] in D:\a\1\s\Xamarin.Forms.Core\GridCalc.cs:43 at Xamarin.Forms.Layout.UpdateChildrenLayout () [0x00158] in D:\a\1\s\Xamarin.Forms.Core\Layout.cs:239 at Xamarin.Forms.Layout.OnSizeAllocated (System.Double width, System.Double height) [0x0000f] in D:\a\1\s\Xamarin.Forms.Core\Layout.cs:203 at Xamarin.Forms.VisualElement.SizeAllocated (System.Double width, System.Double height) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:876 at Xamarin.Forms.VisualElement.SetSize (System.Double width, System.Double height) [0x00021] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:1108 at Xamarin.Forms.VisualElement.set_Bounds (Xamarin.Forms.Rectangle value) [0x0005d] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:415 at Xamarin.Forms.VisualElement.Layout (Xamarin.Forms.Rectangle bounds) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:785 at Xamarin.Forms.Layout.LayoutChildIntoBoundingRegion (Xamarin.Forms.VisualElement child, Xamarin.Forms.Rectangle region) [0x001da] in D:\a\1\s\Xamarin.Forms.Core\Layout.cs:157 at Xamarin.Forms.TemplatedView.LayoutChildren (System.Double x, System.Double y, System.Double width, System.Double height) [0x00019] in D:\a\1\s\Xamarin.Forms.Core\TemplatedView.cs:29 at Xamarin.Forms.Layout.UpdateChildrenLayout () [0x00158] in D:\a\1\s\Xamarin.Forms.Core\Layout.cs:239 at Xamarin.Forms.Layout.OnSizeAllocated (System.Double width, System.Double height) [0x0000f] in D:\a\1\s\Xamarin.Forms.Core\Layout.cs:203 at Xamarin.Forms.VisualElement.SizeAllocated (System.Double width, System.Double height) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:876 at Xamarin.Forms.VisualElement.SetSize (System.Double width, System.Double height) [0x00021] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:1108 at Xamarin.Forms.VisualElement.set_Bounds (Xamarin.Forms.Rectangle value) [0x0005d] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:415 at Xamarin.Forms.VisualElement.Layout (Xamarin.Forms.Rectangle bounds) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:785 at Xamarin.Forms.Layout.LayoutChildIntoBoundingRegion (Xamarin.Forms.VisualElement child, Xamarin.Forms.Rectangle region) [0x001da] in D:\a\1\s\Xamarin.Forms.Core\Layout.cs:157 at Xamarin.Forms.Grid.LayoutChildren (System.Double x, System.Double y, System.Double width, System.Double height) [0x00150] in D:\a\1\s\Xamarin.Forms.Core\GridCalc.cs:43 at Xamarin.Forms.Layout.UpdateChildrenLayout () [0x00158] in D:\a\1\s\Xamarin.Forms.Core\Layout.cs:239 at Xamarin.Forms.Layout.OnSizeAllocated (System.Double width, System.Double height) [0x0000f] in D:\a\1\s\Xamarin.Forms.Core\Layout.cs:203 at Xamarin.Forms.VisualElement.SizeAllocated (System.Double width, System.Double height) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:876 at Xamarin.Forms.VisualElement.SetSize (System.Double width, System.Double height) [0x00021] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:1108 at Xamarin.Forms.VisualElement.set_Bounds (Xamarin.Forms.Rectangle value) [0x0005d] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:415 at Xamarin.Forms.VisualElement.Layout (Xamarin.Forms.Rectangle bounds) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:785 at Xamarin.Forms.Layout.LayoutChildIntoBoundingRegion (Xamarin.Forms.VisualElement child, Xamarin.Forms.Rectangle region) [0x001da] in D:\a\1\s\Xamarin.Forms.Core\Layout.cs:157 at Xamarin.Forms.TemplatedView.LayoutChildren (System.Double x, System.Double y, System.Double width, System.Double height) [0x00019] in D:\a\1\s\Xamarin.Forms.Core\TemplatedView.cs:29 at Xamarin.Forms.Layout.UpdateChildrenLayout () [0x00158] in D:\a\1\s\Xamarin.Forms.Core\Layout.cs:239 at Xamarin.Forms.Layout.OnSizeAllocated (System.Double width, System.Double height) [0x0000f] in D:\a\1\s\Xamarin.Forms.Core\Layout.cs:203 at Xamarin.Forms.VisualElement.SizeAllocated (System.Double width, System.Double height) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:876 at Xamarin.Forms.VisualElement.SetSize (System.Double width, System.Double height) [0x00021] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:1108 at Xamarin.Forms.VisualElement.set_Bounds (Xamarin.Forms.Rectangle value) [0x0005d] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:415 at Xamarin.Forms.VisualElement.Layout (Xamarin.Forms.Rectangle bounds) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:785 at Xamarin.Forms.Layout.LayoutChildIntoBoundingRegion (Xamarin.Forms.VisualElement child, Xamarin.Forms.Rectangle region) [0x001da] in D:\a\1\s\Xamarin.Forms.Core\Layout.cs:157 at Xamarin.Forms.Grid.LayoutChildren (System.Double x, System.Double y, System.Double width, System.Double height) [0x00150] in D:\a\1\s\Xamarin.Forms.Core\GridCalc.cs:43 at Xamarin.Forms.Layout.UpdateChildrenLayout () [0x00158] in D:\a\1\s\Xamarin.Forms.Core\Layout.cs:239 at Xamarin.Forms.Layout.OnSizeAllocated (System.Double width, System.Double height) [0x0000f] in D:\a\1\s\Xamarin.Forms.Core\Layout.cs:203 at Xamarin.Forms.VisualElement.SizeAllocated (System.Double width, System.Double height) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:876 at Xamarin.Forms.VisualElement.SetSize (System.Double width, System.Double height) [0x00021] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:1108 at Xamarin.Forms.VisualElement.set_Bounds (Xamarin.Forms.Rectangle value) [0x0005d] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:415 at Xamarin.Forms.VisualElement.Layout (Xamarin.Forms.Rectangle bounds) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:785 at Xamarin.Forms.Layout.LayoutChildIntoBoundingRegion (Xamarin.Forms.VisualElement child, Xamarin.Forms.Rectangle region) [0x001da] in D:\a\1\s\Xamarin.Forms.Core\Layout.cs:157 at Xamarin.Forms.Page.LayoutChildren (System.Double x, System.Double y, System.Double width, System.Double height) [0x0010d] in D:\a\1\s\Xamarin.Forms.Core\Page.cs:296 at Xamarin.Forms.Page.UpdateChildrenLayout () [0x000ca] in D:\a\1\s\Xamarin.Forms.Core\Page.cs:375 at Xamarin.Forms.Page.OnSizeAllocated (System.Double width, System.Double height) [0x0000f] in D:\a\1\s\Xamarin.Forms.Core\Page.cs:355 at PCCOM.Distrib.Presentation.Preventa.View.Views.Helpers.PageBase.OnSizeAllocated (System.Double width, System.Double height) [0x00008] in C:\Proyectos\PreventaGIT\Preventa\src\Presentation.Preventa.View\Views\Helpers\PageBase.cs:201 at Xamarin.Forms.VisualElement.SizeAllocated (System.Double width, System.Double height) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:876 at Xamarin.Forms.VisualElement.SetSize (System.Double width, System.Double height) [0x00021] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:1108 at Xamarin.Forms.VisualElement.set_Bounds (Xamarin.Forms.Rectangle value) [0x0005d] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:415 at Xamarin.Forms.VisualElement.Layout (Xamarin.Forms.Rectangle bounds) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:785 at Xamarin.Forms.Layout.LayoutChildIntoBoundingRegion (Xamarin.Forms.VisualElement child, Xamarin.Forms.Rectangle region) [0x0005f] in D:\a\1\s\Xamarin.Forms.Core\Layout.cs:126 at Xamarin.Forms.Page.LayoutChildren (System.Double x, System.Double y, System.Double width, System.Double height) [0x0010d] in D:\a\1\s\Xamarin.Forms.Core\Page.cs:296 at Xamarin.Forms.Page.UpdateChildrenLayout () [0x000ca] in D:\a\1\s\Xamarin.Forms.Core\Page.cs:375 at Xamarin.Forms.Page.OnSizeAllocated (System.Double width, System.Double height) [0x0000f] in D:\a\1\s\Xamarin.Forms.Core\Page.cs:355 at Xamarin.Forms.VisualElement.SizeAllocated (System.Double width, System.Double height) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:876 at Xamarin.Forms.Page.OnChildMeasureInvalidated (Xamarin.Forms.VisualElement child, Xamarin.Forms.Internals.InvalidationTrigger trigger) [0x000a9] in D:\a\1\s\Xamarin.Forms.Core\Page.cs:414 at Xamarin.Forms.Page.OnChildMeasureInvalidated (System.Object sender, System.EventArgs e) [0x00013] in D:\a\1\s\Xamarin.Forms.Core\Page.cs:337 at Xamarin.Forms.VisualElement.InvalidateMeasureInternal (Xamarin.Forms.Internals.InvalidationTrigger trigger) [0x0000b] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:903 at Xamarin.Forms.VisualElement.set_IsPlatformEnabled (System.Boolean value) [0x0001c] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:645 at Xamarin.Forms.Platform.Android.Platform+<>c.<.cctor>b125_0 (Xamarin.Forms.BindableObject bindable, System.Object oldvalue, System.Object newvalue) [0x0000a] in D:\a\1\s\Xamarin.Forms.Platform.Android\Platform.cs:41 at Xamarin.Forms.BindableObject.SetValueActual (Xamarin.Forms.BindableProperty property, Xamarin.Forms.BindableObject+BindablePropertyContext context, System.Object value, System.Boolean currentlyApplying, Xamarin.Forms.Internals.SetValueFlags attributes, System.Boolean silent) [0x00120] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:512 at Xamarin.Forms.BindableObject.SetValueCore (Xamarin.Forms.BindableProperty property, System.Object value, Xamarin.Forms.Internals.SetValueFlags attributes, Xamarin.Forms.BindableObject+SetValuePrivateFlags privateAttributes) [0x00173] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:446 at Xamarin.Forms.BindableObject.SetValue (Xamarin.Forms.BindableProperty property, System.Object value, System.Boolean fromStyle, System.Boolean checkAccess) [0x0004d] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:374 at Xamarin.Forms.BindableObject.SetValue (Xamarin.Forms.BindableProperty property, System.Object value) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:349 at Xamarin.Forms.Platform.Android.Platform.SetRenderer (Xamarin.Forms.VisualElement bindable, Xamarin.Forms.Platform.Android.IVisualElementRenderer value) [0x00000] in D:\a\1\s\Xamarin.Forms.Platform.Android\Platform.cs:376 at Xamarin.Forms.Platform.Android.AppCompat.FragmentContainer.OnCreateView (Android.Views.LayoutInflater inflater, Android.Views.ViewGroup container, Android.OS.Bundle savedInstanceState) [0x00025] in D:\a\1\s\Xamarin.Forms.Platform.Android\AppCompat\FragmentContainer.cs:58 at AndroidX.Fragment.App.Fragment.n_OnCreateView_Landroid_view_LayoutInflater_Landroid_view_ViewGroup_Landroid_osBundle (System.IntPtr jnienv, System.IntPtr nativethis, System.IntPtr native_inflater, System.IntPtr native_container, System.IntPtr native_savedInstanceState) [0x00021] in D:\a\1\s\generated\androidx.fragment.fragment\obj\Release\monoandroid9.0\generated\src\AndroidX.Fragment.App.Fragment.cs:1977 at (wrapper dynamic-method) Android.Runtime.DynamicMethodNameCounter.41(intptr,intptr,intptr,intptr,intptr)}

Steps to Reproduce

  1. Come into view with huge xaml
  2. Go back to the previous view
  3. Repeat step 1 and 2 many times (Sometimes the second time it happens, other times it can take a long time to happen)

Expected Behavior

Open the view without any error

Actual Behavior

Exception attached to the issue

Basic Information

Environment

  1. Visual Studio: Microsoft Visual Studio Enterprise 2022 Version 17.1.0 Preview 1.1 VisualStudio.17.Preview/17.1.0-pre.1.1+31911.260 Microsoft .NET Framework Version 4.8.04084

Installed Version: Enterprise

Visual C++ 2022 00476-80000-00000-AA362 Microsoft Visual C++ 2022

.NET Core Debugging with WSL 1.0 .NET Core Debugging with WSL

ASP.NET and Web Tools 2019 17.1.126.26097 ASP.NET and Web Tools 2019

ASP.NET Web Frameworks and Tools 2019 17.1.126.26097 For additional information, visit https://www.asp.net/

Azure App Service Tools v3.0.0 17.1.126.26097 Azure App Service Tools v3.0.0

Azure Functions and Web Jobs Tools 17.1.126.26097 Azure Functions and Web Jobs Tools

C# Tools 4.1.0-1.21551.6+e4419d6f6792da7011c8589ba118f59d830ca72f C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Common Azure Tools 1.10 Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.

Extensibility Message Bus 1.2.6 (master@34d6af2) Provides common messaging-based MEF services for loosely coupled Visual Studio extension components communication and integration.

Microsoft Azure Tools for Visual Studio 2.9 Support for Azure Cloud Services projects

Microsoft JVM Debugger 1.0 Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines

Microsoft Library Manager 2.1.134+45632ee938.RR Install client-side libraries easily to any web project

Microsoft MI-Based Debugger 1.0 Provides support for connecting Visual Studio to MI compatible debuggers

Microsoft Visual C++ Wizards 1.0 Microsoft Visual C++ Wizards

Microsoft Visual Studio Tools for Containers 1.2 Develop, run, validate your ASP.NET Core applications in the target environment. F5 your application directly into a container with debugging, or CTRL + F5 to edit & refresh your app without having to rebuild the container.

Microsoft Visual Studio VC Package 1.0 Microsoft Visual Studio VC Package

Mono Debugging for Visual Studio 17.1.4 (dc2a48c) Support for debugging Mono processes with Visual Studio.

NuGet Package Manager 6.1.0 NuGet Package Manager in Visual Studio. For more information about NuGet, visit https://docs.nuget.org/

ProjectServicesPackage Extension 1.0 ProjectServicesPackage Visual Studio Extension Detailed Info

Razor (ASP.NET Core) 17.0.0.2152601+724154d925d7d9d26ebf8a73a66d5219aa320400 Provides languages services for ASP.NET Core Razor.

Snapshot Debugging Extension 1.0 Snapshot Debugging Visual Studio Extension Detailed Info

SQL Server Data Tools 17.0.62110.20190 Microsoft SQL Server Data Tools

TypeScript Tools 17.0.1029.2001 TypeScript Tools for Microsoft Visual Studio

Visual Basic Tools 4.1.0-1.21551.6+e4419d6f6792da7011c8589ba118f59d830ca72f Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Visual F# Tools 17.1.0-beta.21525.2+46af4a248255f4af2284883f48983fe7dd07a760 Microsoft Visual F# Tools

Visual Studio Code Debug Adapter Host Package 1.0 Interop layer for hosting Visual Studio Code debug adapters in Visual Studio

Visual Studio Container Tools Extensions 1.0 View, manage, and diagnose containers within Visual Studio.

Visual Studio IntelliCode 2.2 AI-assisted development for Visual Studio.

Visual Studio Tools for Containers 1.0 Visual Studio Tools for Containers

VisualStudio.DeviceLog 1.0 Information about my package

VisualStudio.Foo 1.0 Information about my package

VisualStudio.Mac 1.0 Mac Extension for Visual Studio

Xamarin 17.1.0.163 (d17-1-p1@42933de) Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin Designer 17.1.0.43 (remotes/origin/main@931878527) Visual Studio extension to enable Xamarin Designer tools in Visual Studio.

Xamarin Templates 17.1.8 (590388a) Templates for building iOS, Android, and Windows apps with Xamarin and Xamarin.Forms.

Xamarin.Android SDK 12.1.99.56 (main/43243b4) Xamarin.Android Reference Assemblies and MSBuild support. Mono: c633fe9 Java.Interop: xamarin/java.interop/main@79744f61 ProGuard: Guardsquare/proguard/v7.0.1@912d149 SQLite: xamarin/sqlite/3.36.0@a575761 Xamarin.Android Tools: xamarin/xamarin-android-tools/main@a5194e9

Xamarin.iOS and Xamarin.Mac SDK 15.3.0.41 (7b786db64) Xamarin.iOS and Xamarin.Mac Reference Assemblies and MSBuild support. Visual Studio for Mac: Visual Studio > About Visual Studio > Show Details > Copy Information [button]

Reproduction Link

Currently we do not have any small sample to attach to reproduce the issue (in fact, we do not know how to reproduce it 100%, as I said before it happens randomly from the second time I enter the view).

I have created the bug issue attaching the exception to see if someone from the community can provide us with a clue about what may be causing the bug.

Edited:

I have also seen this in visual studio output:

System.InvalidCastException: 'Specified cast is not valid.'

[mono-rt] [ERROR] FATAL UNHANDLED EXCEPTION: System.InvalidCastException: Specified cast is not valid. [mono-rt] at (wrapper dynamic-method) Android.Runtime.DynamicMethodNameCounter.41(intptr,intptr,intptr,intptr,intptr) [mono-rt] at (wrapper native-to-managed) Android.Runtime.DynamicMethodNameCounter.41(intptr,intptr,intptr,intptr,intptr) [HostConnection] HostConnection::get() New Host Connection established 0xbb01aff0, tid 29187 [HostConnection] HostComposition ext ANDROID_EMU_CHECKSUM_HELPER_v1 ANDROID_EMU_native_sync_v2 ANDROID_EMU_dma_v1 ANDROID_EMU_YUV420_888_to_NV21 ANDROID_EMU_YUV_Cache ANDROID_EMU_sync_buffer_data GL_OES_EGL_image_external_essl3 GL_OES_vertex_array_object GL_KHR_texture_compression_astc_ldr ANDROID_EMU_host_side_tracing ANDROID_EMU_gles_max_version_3_0 [EGL_emulation] tid 29259: eglSwapBuffers(1934): error 0x3001 (EGL_NOT_INITIALIZED) [OpenGLRenderer] Encountered EGL error 12289 EGL_NOT_INITIALIZED during rendering [google-breakpad] ### ### ### ### ### ### ### ### ### ### ### ### ### [google-breakpad] Chrome build fingerprint: [google-breakpad] 69.0.3497.100 [google-breakpad] 349710017 [google-breakpad] ### ### ### ### ### ### ### ### ### ### ### ### ### [libc] Fatal signal 6 (SIGABRT), code -6 (SI_TKILL) in tid 29259 (RenderThread), pid 29187 (e.Preventa.View)

ghost commented 2 years ago

I can verify that this happens on my project as well with the collection view but randomly and very rare i would say, it happens when the collection view is loading items asynchronously and the scroll is updated too fast i solved it by slowing it down. Below is a screenshot of the exception taken from firebase crashlytics dashboard Screenshot_2021-12-19 DirectSougFBS – D a 1 s Xamarin Forms Core TemplatedItemsList cs line 540 – Firebase console

jfversluis commented 2 years ago

Hey there, thanks for the report! Do you have any idea if this happens on all platforms or just on one? @scicom02 I see in your screenshot that Android is mentioned. Do you also see reports for iOS?

ghost commented 2 years ago

Hey there, thanks for the report! Do you have any idea if this happens on all platforms or just on one? @scicom02 I see in your screenshot that Android is mentioned. Do you also see reports for iOS?

Hello am sorry for replying so late, we don't have an iOS report yet only android 11 (Samsung A22)

davidbuckleyni commented 2 years ago

Seems to be an error in ur grid calc function

ghost commented 2 years ago

Hey there, thanks for the report! Do you have any idea if this happens on all platforms or just on one? @scicom02 I see in your screenshot that Android is mentioned. Do you also see reports for iOS?

This just came in today on iOS, am not sure if its related to this issue but it occurred on a CollectionView

Screenshot_2021-12-26 DirectSougFBS – D a 1 s Xamarin Forms Platform iOS CollectionView ItemsViewController cs line 117 – F

Screenshot_2021-12-26 DirectSougFBS – D a 1 s Xamarin Forms Platform iOS CollectionView ItemsViewController cs line 117 – F (1)