Everything works well & great with X.F v - 2.5, but when I updated my X.F v to 4.2 due to some issues the app started to crash on line 153 of your code (return (View)template.CreateContent();) giving an exception as System.NullReferenceException: 'Object reference not set to an instance of an object.' & inner exception as System.InvalidOperationException: Method may only be called on a Type for which Type.IsGenericParameter is true.
I'm facing a problem with the binding of generic observable collection to the data template.
I found the below stack trace of exception -
at STMobile.View.SurveyManagerPage+<InitializeComponent>_anonXamlCDataTemplate_88.LoadDataTemplate () [0x003df] in :0
at Xamarin.Forms.ElementTemplate.CreateContent () [0x00026] in D:\a\1\s\Xamarin.Forms.Core\ElementTemplate.cs:82
at STMobile.CustomControls.ItemsStack.CreateChildViewFor (Xamarin.Forms.DataTemplate template, System.Object item, Xamarin.Forms.BindableObject container) [0x00029] in F:\Blu Xamarin\Sample\ST UI Only\STMobile\STMobile\CustomControls\ItemsStack.cs:196
at STMobile.CustomControls.ItemsStack.ItemsChanged (Xamarin.Forms.BindableObject bindable, System.Object oldValue, System.Object newValue) [0x000b4] in F:\Blu Xamarin\Sample\ST UI Only\STMobile\STMobile\CustomControls\ItemsStack.cs:121
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:445
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:379
at Xamarin.Forms.BindingExpression.ApplyCore (System.Object sourceObject, Xamarin.Forms.BindableObject target, Xamarin.Forms.BindableProperty property, System.Boolean fromTarget) [0x00220] in D:\a\1\s\Xamarin.Forms.Core\BindingExpression.cs:167
at Xamarin.Forms.BindingExpression.Apply (System.Boolean fromTarget) [0x0003e] in D:\a\1\s\Xamarin.Forms.Core\BindingExpression.cs:57
at Xamarin.Forms.BindingExpression+BindingExpressionPart.<PropertyChanged>b__49_0 () [0x00000] in D:\a\1\s\Xamarin.Forms.Core\BindingExpression.cs:622
at Java.Lang.Thread+RunnableImplementor.Run () [0x00008] in /Users/runner/runners/2.164.7/work/1/s/xamarin-android/src/Mono.Android/Java.Lang/Thread.cs:36
at Java.Lang.IRunnableInvoker.n_Run (System.IntPtr jnienv, System.IntPtr native__this) [0x00009] in /Users/runner/runners/2.164.7/work/1/s/xamarin-android/src/Mono.Android/obj/Release/android-27/mcw/Java.Lang.IRunnable.cs:81
at (wrapper dynamic-method) Android.Runtime.DynamicMethodNameCounter.41(intptr,intptr)
If you need more information about it, let me know.
Trying to solve the same issue from a week still no success. Any help will be appreciated...
Thank you.