Need More Info
Last Updated: 05 May 2025 12:59 by Rodrigo
Malcolm
Created on: 28 Feb 2025 15:36
Category: CollectionView
Type: Bug Report
3
Crash for RadCollectionView
Our error reporting is getting multiple of these crashes:
Message: Object reference not set to an instance of an object
Telerik.Maui.Data.LocalDataSourceProvider.ProcessCollectionChanged(NotifyCollectionChangedEventArgs e)
Telerik.Maui.Data.LocalDataSourceProvider.ProcessPendingChanges()
Telerik.Maui.Data.LocalDataSourceProvider.OnCompleted(Object sender, DataEngineCompletedEventArgs e)
Telerik.Maui.Data.ParallelDataEngine.RaiseCompleted(DataEngineCompletedEventArgs args)
Telerik.Maui.Data.ParallelDataEngine.ProcessBottomLevelsParallel(Task`1 bottomLevelResultsTask, ParallelState parallelState)
Telerik.Maui.Data.ParallelDataEngine+<>c__DisplayClass102_0.<BeginParallelProcessing>b__1(Task`1 task)
System.Threading.Tasks.ContinuationTaskFromResultTask`1[[Telerik.Maui.Data.ParallelDataEngine+GroupingResults, Telerik.Maui.Core, Version=10.0.0.0, Culture=neutral, PublicKeyToken=5803cfa389c90ce7]].InnerInvoke()
System.Threading.Tasks.Task+<>c.<.cctor>b__292_0(Object obj)
System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread , ExecutionContext , ContextCallback , Object )
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread , ExecutionContext , ContextCallback , Object )
System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& , Thread )

unfortunately we don't have a repro for this crash just yet.

It does look like it's occuring on iOS only.
19 comments
Rodrigo
Posted on: 05 May 2025 12:59

Hi Didi,

Just a quick update regarding the issue I previously reported.

Setting animation: false in the ScrollItemIntoView method helped significantly to reduce the problem. However, during field testing, I encountered the issue once again. It is now very rare and hard to reproduce, but it still results in the same exception:

EXCEPTION: System.NullReferenceException: Object reference not set to an instance of an object
   at Telerik.Maui.Controls.RadCollectionView.<OnScrollViewScrolled>b__159_0()

This indicates the issue is not fully resolved, although it happens much less frequently now.

I understand this may be difficult to track down due to its intermittent nature. You may need to treat this as a separate issue from this ticket and open a separate one.

Best regards,
Rodrigo

ADMIN
Didi
Posted on: 24 Apr 2025 05:19

Hello Rodrigo,

I was going to suggest a loading indicator during the collect operations. I am glad you found a solution for solving the null ref exception.

However the initially reported exception by Malcolm

Message: Object reference not set to an instance of an object
Telerik.Maui.Data.LocalDataSourceProvider.ProcessCollectionChanged(NotifyCollectionChangedEventArgs e)
Telerik.Maui.Data.LocalDataSourceProvider.ProcessPendingChanges()

is still not solved. Based on the initial replies it happens on iOS. 

@Malcolm, I hope you can isolate the issue in a sample and send it back to me for further research. I am changing the status of this bug report to Need Mode Info.

Regards,
Didi
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Rodrigo
Posted on: 23 Apr 2025 18:25

Hi Didi!

 

After further testing, I was able to consistently prevent the issue by disabling the animation in the ScrollItemIntoView method. Once I set animation: false, the exception stopped occurring during navigation back.

listView.ScrollItemIntoView(itemData.SelectedItem, false);

It seems the problem was related to the ongoing scroll animation when navigating back, which caused the crash. Disabling the animation resolved the issue in my case.

Regards,

Rodrigo

Rodrigo
Posted on: 23 Apr 2025 13:50

Hello Didi,

Thanks for the clarification.

In my production app, even after collecting all items and waiting on the page for a while before navigating back, the issue still occasionally occurs — although it's much rarer.

What I shared earlier was a forced test scenario, just to help reproduce the issue more easily. In the actual app, I'm not triggering navigation during ongoing operations — but it seems the error can still happen under specific timing conditions.

Additionally, in my app I also make sure to prevent ScrollItemIntoView from being called on page disappear. For example:

protected override void OnDisappearing()
{
    if (_isEventAttached && listView != null)
    {
        listView.SelectionChanged -= listView_SelectionChanged;
        _isEventAttached = false;
    }

    base.OnDisappearing();
}

Even with this precaution, the issue I mentioned still happens occasionally.

Let me know if there's anything else I can try or monitor on my side.

Regards,
Rodrigo

ADMIN
Didi
Posted on: 23 Apr 2025 09:18

Hello Rodrigo,

Thank you for the gif, I see the exact steps. i do not need the modal async, the initial project was enough.

What happens is at the time you navigate back the collect operation is still executing and the CollectionView scrolls. So there is a running operation on this page and at this time you navigate back and null ref exception occurs. In general, you have to stop executing the custom logic or add a bit of delay to be sure that all data gets updated before navigating back. This scenario should be handled in the custom logic. For example, you can cancel executing the command when back button is pressed, etc. or find another approach.

A sample test scenario with the scrolling -> when scrolling the CollectionView without pressing the collect button and then press the back button while the control scrolls, no exception. 

Regards,
Didi
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Rodrigo
Posted on: 17 Apr 2025 18:20

Hello Didi,

After further investigation and testing in my application (especially in debug mode), I was able to consistently reproduce the issue.

The key detail is that my app is using modal navigation.

To reproduce the issue in the sample I previously shared, simply update the navigation line as follows:


private void OnButtonClicked(object sender, EventArgs e)

{ //Navigation.PushAsync(new CollectionPage()); Navigation.PushModalAsync(new CollectionPage()); }

After switching from PushAsync to PushModalAsync, the issue starts occurring when navigating back.

To trigger the problem:

  1. Tap on "Collect" to start the collection process.

  2. While it’s collecting, tap on another item from a different group.

  3. Then navigate back to the previous screen.

This sequence consistently reproduces the exception.

I hope this helps to reproduce and diagnose the issue.

 

Regards,

Rodrigo.

 

Attached Files:
ADMIN
Didi
Posted on: 15 Apr 2025 06:03

Hello Rodrigo,

I tested the app on Android emulator and on a real device in debug and in release mode, tested several times an no issues, no crash. I repeated the steps around 20 times and no crash. Maybe the issue happens randomly and it is hard to reproduce. 

Regards,
Didi
Progress Telerik

Enjoyed our products? Share your experience on G2 and receive a $25 Amazon gift card for a limited time!

Rodrigo
Posted on: 08 Apr 2025 13:59

Hi Didi,

I was able to generate an app that reproduces the issue, but it only happens in release mode.

To trigger it:
- Open the app and navigate to the CollectionPage screen.
- Tap the "Collect" button and perform several collects.
- Then go back to the previous screen.
- Repeat this process a few times.

Sometimes after entering the CollectionPage a second time, the app will close, or crash — but it's not consistent. It can happen after a few repetitions.

Hope you're able to reproduce it.

 

Attached Files:
ADMIN
Didi
Posted on: 08 Apr 2025 08:00

Hi Rodrigo,

Thank you for the provided details.

I need a sample app where the issue occurs, then I can further research this. If you can isolate the behavior, please send the app and exact steps to reproduce the issue.

Regards,
Didi
Progress Telerik

Rodrigo
Posted on: 07 Apr 2025 19:40

Hi Didi,

Unfortunately, I wasn't able to reproduce the issue consistently in my app, and as I mentioned, it's hard to pinpoint exactly when it happens.

To help diagnose it, I made the following change in my application to capture it in the log:

public partial class App : Application
{
    public App()
    {
        InitializeComponent();

        // Catch unhandled exceptions on the main thread
        AppDomain.CurrentDomain.UnhandledException += OnUnhandledException;

        // Catch unobserved task exceptions
        TaskScheduler.UnobservedTaskException += OnUnobservedTaskException;
    }

    private void OnUnhandledException(object sender, UnhandledExceptionEventArgs e)
    {
        if (e.ExceptionObject is Exception ex)
        {
            App.loggingService.Error(ex, "UnhandledException");
        }
        else
        {
            App.loggingService.Error($"ExceptionObject (non-Exception): {e.ExceptionObject?.ToString()}\n");
        }
    }

    private void OnUnobservedTaskException(object sender, UnobservedTaskExceptionEventArgs e)
    {
        App.loggingService.Error("UnobservedTaskException", e.Exception);
        e.SetObserved(); // Prevents the app from crashing
    }
}

This is what I captured in the logs:

ERROR: UnhandledException
EXCEPTION: System.NullReferenceException: Object reference not set to an instance of an object
   at Telerik.Maui.Controls.RadCollectionView.<OnScrollViewScrolled>b__159_0()
   at Microsoft.Maui.Dispatching.Dispatcher.<>c__DisplayClass3_0.<DispatchImplementation>b__0()
   at Java.Lang.Thread.RunnableImplementor.Run()
   at Java.Lang.IRunnableInvoker.n_Run(IntPtr jnienv, IntPtr native__this)
   at Android.Runtime.JNINativeWrapper.Wrap_JniMarshal_PP_V(_JniMarshal_PP_V callback, IntPtr jnienv, IntPtr klazz)

My current setup is:

  • .NET 9 (Android)

  • Telerik UI for .NET MAUI version 10.1.0

  • Microsoft.Maui.Controls - Version: 9.0.50

  • Microsoft.Maui.Controls.Compatibility - Version: 9.0.50

  • Android 13

If I'm able to create a sample app that reproduces the issue, I will share it with you.

Thanks!

ADMIN
Didi
Posted on: 07 Apr 2025 06:10

Hi Rodrigo,

Please send a sample project where the issue can be reproduced. Then we can research the case further. Also on which android devices versions the issue happens and what is the exact .NET Maui version you use. 

Regards,
Didi
Progress Telerik

Enjoyed our products? Share your experience on G2 and receive a $25 Amazon gift card for a limited time!

Rodrigo
Posted on: 04 Apr 2025 19:32

Hi!

I am facing the same issue with RadCollectionView in .NET MAUI.
The application crashes unexpectedly, and in the Android log, I was only able to identify this:

I am using .NET 9(Android) and tested with Telerik UI for .NET MAUI versions 10.0.0 and 10.1.0.

  • Microsoft.Maui.Controls - Version: 9.0.50

  • Microsoft.Maui.Controls.Compatibility - Version: 9.0.50

Unfortunately, I haven’t been able to determine a specific action or moment when the crash consistently occurs.
However, it tends to happen after navigating through items in the RadCollectionView, and repeatedly leaving and entering the page.

Please let me know if there is a fix or workaround for this issue.

 

 FATAL EXCEPTION: main

 android.runtime.JavaProxyThrowable: [System.NullReferenceException]: Object reference not set to an instance of an object
at Telerik.Maui.Controls.RadCollectionView.<OnScrollViewScrolled>b__159_0 + 0x23(Unknown Source)
at Microsoft.Maui.Dispatching.Dispatcher+<>c__DisplayClass3_0.<DispatchImplementation>b__0 + 0x0(Unknown Source)
at Java.Lang.Thread+RunnableImplementor.Run + 0x8(Unknown Source)
at Java.Lang.IRunnableInvoker.n_Run + 0x8(Unknown Source)
at Android.Runtime.JNINativeWrapper.Wrap_JniMarshal_PP_V + 0x5(Unknown Source)
at mono.java.lang.RunnableImplementor.n_run(Native Method)
at mono.java.lang.RunnableImplementor.run(RunnableImplementor.java:29)
at android.os.Handler.handleCallback(Handler.java:942)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:226)
at android.os.Looper.loop(Looper.java:313)
at android.app.ActivityThread.main(ActivityThread.java:8762)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:604)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1067)
 Shared library 'liblog' not loaded, p/invoke '__android_log_print' may fail
 UNHANDLED EXCEPTION:
 Android.Runtime.JavaProxyThrowable: Exception_WasThrown, Android.Runtime.JavaProxyThrowable

               
Malcolm
Posted on: 07 Mar 2025 07:49
@Didi - unfortunately we are unable to repro just yet as it does not happen reliably.
I'll post an update if we have new info
ADMIN
Didi
Posted on: 04 Mar 2025 14:02

Hi Malcolm,

We applied fixes for CollectionView scrolling in 10.0.0 version. This somehow could be related to the fixes. However, I will need a repro project which I can share with the dev team so they can research the case further. Once we are able to reproduce the behavior we will be able to investigate it further and provide more information on the matter. 

Regards,
Didi
Progress Telerik

Enjoyed our products? Share your experience on G2 and receive a $25 Amazon gift card for a limited time!

Malcolm
Posted on: 04 Mar 2025 13:47

@Didi - see comments below... this wasn't happening in 9.0.0 version of the library.

Our crash analytics are reporting it as an unobserved task exception thrown on the dispatcher thread pool - so we can't trace exactly which of our many collection views are throwing it.
So

- 10.0.0 only

- iOS only (we don't see any exceptions reported like this for Android)

ADMIN
Didi
Posted on: 04 Mar 2025 12:03

Hi all,

Thank you for the stack-trace.

Could you please share some guidance in what cases the crash happens? Based on the stack trace it seems the control is grouped. Also there is a scrolling method mentioned. 

What are the operations you execute with the CollectionView in which the crash happens? Also downgrade to 9.0.0 version and let me know whether the crash also happens in it.

Regards,
Didi
Progress Telerik

Enjoyed our products? Share your experience on G2 and receive a $25 Amazon gift card for a limited time!

Zelin
Posted on: 03 Mar 2025 20:03
I am also experiencing this issue occasionally and it is hard to reproduce.
Malcolm
Posted on: 03 Mar 2025 09:33
I can also say that these have been happening since updating from 9.0.0 to 10.0.0 nuget packages
Malcolm
Posted on: 03 Mar 2025 09:22
perhaps related - we're seeing this guy too:
Message: Object reference not set to an instance of an object.
Telerik.Maui.Controls.RadCollectionView.<OnScrollViewScrolled>b__159_0()
Microsoft.Maui.Dispatching.Dispatcher+<>c__DisplayClass9_0.<DispatchImplementation>b__0()
CoreFoundation.DispatchQueue.static_dispatcher_to_managed(IntPtr context)
UIKit.UIApplication.UIApplicationMain(Int32 , String[] , IntPtr , IntPtr )
UIKit.UIApplication.Main(String[] , Type , Type )
SkimmerPhone.Platforms.iOS.Application.Main(String[] args)