ProgressBar - Exceptions

Hi,

Could you please check and advise the fix for below random exceptions. The controls are updated from nuget as well.

Thanks.


Exception 1

Index was outside the bounds of the array.

  at System.Collections.Generic.Dictionary`2[TKey,TValue].TryGetValue (TKey key, TValue& value) [0x0000c] in <65ee9686e7104ac1bf9d2aea72d18981>:0

   at Xamarin.Forms.ResourceDictionary.TryGetValueAndSource (System.String key, System.Object& value, Xamarin.Forms.ResourceDictionary& source) [0x00003] in <d94e2f1a85914d9da1fd09356f374550>:0

   at Xamarin.Forms.ResourceDictionary.TryGetValueAndSource (System.String key, System.Object& value, Xamarin.Forms.ResourceDictionary& source) [0x0001a] in <d94e2f1a85914d9da1fd09356f374550>:0

   at Xamarin.Forms.ResourceDictionary.TryGetValue (System.String key, System.Object& value) [0x00000] in <d94e2f1a85914d9da1fd09356f374550>:0

   at Xamarin.Forms.ResourcesExtensions.TryGetResource (Xamarin.Forms.IElement element, System.String key, System.Object& value) [0x00070] in <d94e2f1a85914d9da1fd09356f374550>:0

   at Xamarin.Forms.Element.OnSetDynamicResource (Xamarin.Forms.BindableProperty property, System.String key) [0x00015] in <d94e2f1a85914d9da1fd09356f374550>:0

   at Xamarin.Forms.BindableObject.SetDynamicResource (Xamarin.Forms.BindableProperty property, System.String key, System.Boolean fromStyle) [0x00066] in <d94e2f1a85914d9da1fd09356f374550>:0

   at Xamarin.Forms.BindableObject.SetDynamicResource (Xamarin.Forms.BindableProperty property, System.String key) [0x00000] in <d94e2f1a85914d9da1fd09356f374550>:0

   at Xamarin.Forms.Element.SetDynamicResource (Xamarin.Forms.BindableProperty property, System.String key) [0x00000] in <d94e2f1a85914d9da1fd09356f374550>:0

   at Syncfusion.XForms.Themes.ThemeElement.InitializeThemeResources (Xamarin.Forms.Element element, System.String controlKey) [0x0009d] in <5170961e2e1245d486ab784c8a0e77e4>:0

   at Syncfusion.XForms.ProgressBar.ProgressBarBase..ctor () [0x0003d] in <c0a698525f364813a263dc012ef26b93>:0

   at Syncfusion.XForms.ProgressBar.SfCircularProgressBar..ctor () [0x0000f] in <c0a698525f364813a263dc012ef26b93>:0


Exception 2

Index was outside the bounds of the array.

 at System.Collections.Generic.Dictionary`2[TKey,TValue].TryGetValue (TKey key, TValue& value) [0x0000c] in <65ee9686e7104ac1bf9d2aea72d18981>:0

   at Xamarin.Forms.ResourceDictionary.TryGetValueAndSource (System.String key, System.Object& value, Xamarin.Forms.ResourceDictionary& source) [0x00003] in <d94e2f1a85914d9da1fd09356f374550>:0

   at Xamarin.Forms.ResourceDictionary.TryGetValue (System.String key, System.Object& value) [0x00000] in <d94e2f1a85914d9da1fd09356f374550>:0

   at Xamarin.Forms.ResourceDictionary.TryGetMergedDictionaryValue (System.String key, System.Object& value, Xamarin.Forms.ResourceDictionary& source) [0x0001a] in <d94e2f1a85914d9da1fd09356f374550>:0

   at Xamarin.Forms.ResourceDictionary.TryGetValueAndSource (System.String key, System.Object& value, Xamarin.Forms.ResourceDictionary& source) [0x00032] in <d94e2f1a85914d9da1fd09356f374550>:0

   at Xamarin.Forms.ResourceDictionary.TryGetValueAndSource (System.String key, System.Object& value, Xamarin.Forms.ResourceDictionary& source) [0x0001a] in <d94e2f1a85914d9da1fd09356f374550>:0

   at Xamarin.Forms.ResourceDictionary.TryGetValue (System.String key, System.Object& value) [0x00000] in <d94e2f1a85914d9da1fd09356f374550>:0

   at Xamarin.Forms.ResourcesExtensions.TryGetResource (Xamarin.Forms.IElement element, System.String key, System.Object& value) [0x00070] in <d94e2f1a85914d9da1fd09356f374550>:0

   at Xamarin.Forms.Element.OnSetDynamicResource (Xamarin.Forms.BindableProperty property, System.String key) [0x00015] in <d94e2f1a85914d9da1fd09356f374550>:0

   at Xamarin.Forms.BindableObject.SetDynamicResource (Xamarin.Forms.BindableProperty property, System.String key, System.Boolean fromStyle) [0x00066] in <d94e2f1a85914d9da1fd09356f374550>:0

   at Xamarin.Forms.BindableObject.SetDynamicResource (Xamarin.Forms.BindableProperty property, System.String key) [0x00000] in <d94e2f1a85914d9da1fd09356f374550>:0

   at Xamarin.Forms.MergedStyle.RegisterImplicitStyles () [0x00051] in <d94e2f1a85914d9da1fd09356f374550>:0

   at Xamarin.Forms.MergedStyle..ctor (System.Type targetType, Xamarin.Forms.BindableObject target) [0x0001f] in <d94e2f1a85914d9da1fd09356f374550>:0

   at Xamarin.Forms.NavigableElement..ctor () [0x00018] in <d94e2f1a85914d9da1fd09356f374550>:0

   at Xamarin.Forms.VisualElement..ctor () [0x00059] in <d94e2f1a85914d9da1fd09356f374550>:0

   at Xamarin.Forms.View..ctor () [0x0000b] in <d94e2f1a85914d9da1fd09356f374550>:0

   at Syncfusion.XForms.ProgressBar.ProgressBarBase..ctor () [0x0002c] in <e4a9e91801e54027a1bca97d51f390aa>:0

   at Syncfusion.XForms.ProgressBar.SfCircularProgressBar..ctor () [0x0000f] in <e4a9e91801e54027a1bca97d51f390aa>:0



6 Replies

YM Yathavakrishnan Mohan Syncfusion Team January 27, 2025 10:24 AM UTC

Hi Raaz,

 

 

We could not reproduce the reported issue using the information provided. For your reference, we’ve attached a sample that we used to try to replicate the issue on our end. If you continue to experience the issue, please modify this sample as needed and share it back with us with detailed replication steps. This will assist us in conducting a more thorough investigation.

 

Regards,

Yathavakrishnan M


Attachment: Xamarin_Progressbar_Sample_c8039edb.zip


RA Raaz January 30, 2025 06:25 PM UTC

Hi Yathavakrishnan,

Thank you for your reply, appreciated.

It is quite difficult to reproduce in sample project as these exception appears in our logs and in firebase, happened to 1 out of 1000 end users. 

These exceptions shared above are in the hope that syncfusion team can analyze as its probably related to the merged resources. 


Below is the additional information


On button click on Change theme

If (currentTheme == "Dark")

         App.Current.Resources = new ThemeLight();


In App.xaml

    <Application.Resources>

        <ResourceDictionary Source="/Themes/ThemeLight.xaml" />

    </Application.Resources>



In ThemeLight.xaml

<ResourceDictionary xmlns="http://xamarin.com/schemas/2014/forms"

                    xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"

                    x:Class="Project.Themes.ThemeLight"

                    xmlns:syncTheme="clr-namespace:Syncfusion.XForms.Themes;assembly=Syncfusion.Core.XForms"

                    xmlns:synccalendar="clr-namespace:Syncfusion.SfCalendar.XForms;assembly=Syncfusion.SfCalendar.XForms"

                    xmlns:syncgauge="clr-namespace:Syncfusion.SfGauge.XForms;assembly=Syncfusion.SfGauge.XForms"

                    xmlns:syncbutton="clr-namespace:Syncfusion.XForms.Buttons;assembly=Syncfusion.Buttons.XForms">


    <ResourceDictionary.MergedDictionaries>

        <syncTheme:LightTheme />

        <synccalendar:SfCalendarStyles />

        <syncgauge:SfCircularGaugeStyles />

    </ResourceDictionary.MergedDictionaries>


    <Style TargetType="Label">

        <Setter Property="TextColor" Value="#1c1e21" />

        <Setter Property="FontSize" Value="15" />

    </Style>

.

.

.

.

.

</ResourceDictionary>





YM Yathavakrishnan Mohan Syncfusion Team January 31, 2025 02:10 PM UTC

Hi Raaz,
We have tried to reproduce the reported issue with the provided details, but the issue was not reproduced. However, You mentioned that the issue occurs 1 out of 1000 times, so we will check the sample multiple times to replicate the issue. We will provide further details by February 4th, 2025.


Regards,
Yathavakrishnan M



YM Yathavakrishnan Mohan Syncfusion Team February 4, 2025 02:51 PM UTC

We attempted to switch the theme based on the provided code snippet, but the theme is not switching properly. After following the documentation steps, the theme is now switching correctly. We have attached a sample for theme switching—please review it. If you continue to experience issues, kindly modify the sample as needed and share it back with us, along with detailed replication steps. This will help us conduct a more thorough investigation. Please refer the below UG link for your reference.

User Guide : How to customize theming in Syncfusion® controls
 


Attachment: Xamarin_Progressbar_Sample_83032a5d.zip


RA Raaz February 7, 2025 05:01 PM UTC

Hi,

Thank you for your feedback and sharing sample.

For clarification, the issue apparently not happening while changing the theme, but while user uses the app screen where progress bar / guage is used to show as download file progress. Below is the sample snippet from the code and also attached different exceptions that appears in log that might help to find the root cause. 



<ListView>

<ListView.ItemTemplate>

<DataTemplate>

<ViewCell Appearing="ViewCell_Appearing">

<Grid Margin="0,5,0,5" Padding="0,10,0,10" RowSpacing="0">

<Grid.RowDefinitions>

<RowDefinition Height="Auto" />

</Grid.RowDefinitions>

<Grid.ColumnDefinitions>

<ColumnDefinition Width="*"/>

</Grid.ColumnDefinitions>

<progressbar:SfCircularProgressBar x:Name="progressC" IndicatorOuterRadius="0.5" HeightRequest="22" WidthRequest="22" TrackColor="{DynamicResource StrColorSelected}" ProgressColor="{DynamicResource StrTextColor}" />

</Grid>

</ViewCell>

</DataTemplate>

</ListView.ItemTemplate>

</ListView>



private static SfCircularProgressBar downloadProgressBar = null;

private static bool downloadProgressForceStop = false;

private static int downloadProgressValue = 0;


private void ViewCell_Appearing(object sender, EventArgs e)

{

    try

    {

        var viewCell = sender as ViewCell;

        if (viewCell != null && viewCell.BindingContext != null)

        {

            Recorder queue = viewCell.BindingContext as Recorder;

            if (queue.IsProcess == 1)

            {

                SfCircularProgressBar pg = viewCell.FindByName("progressC") as SfCircularProgressBar;

                if (pg != null)

                {

                    downloadProgressBar = pg;

                }

            }

        }

    }

    catch (Exception ex)

    {

        //LogException

    }

}


internal static void UpdateDownloadProgress()

{

    Device.StartTimer(new TimeSpan(0, 0, 1), () =>

    {

        try

        {

            if (downloadProgressForceStop || downloadProgressValue >= 100)

            {

                downloadProgressForceStop = false;

                return false;

            }

            if (downloadProgressBar != null)

            {

                downloadProgressBar.Progress = downloadProgressValue;

            }

        }

        catch (Exception ex)

        {

            //LogException

        }

        return true;

    });

}


private async void Download()

{

    Task.Run(() => { Processor.UpdateDownloadProgress(); });

    for (int i = 0; i < 100; i++)

    {

        await Task.Delay(1000);

        downloadProgressValue = i;

    }

    downloadProgressForceStop = true;

}





Attachment: SyncfusionExceptions_8355103f.zip



YM Yathavakrishnan Mohan Syncfusion Team February 10, 2025 01:58 PM UTC

Hi Raaz,


We have checked the provided code snippet and tried to create a sample with the provided code, but we faced issues with the code details below. So, we request you to provide additional details on the below requested details to create the sample and reproduce the issues on our end.


  1. Recorder queue = viewCell.BindingContext as Recorder; - Could you clarify the namespace or assembly reference for the Recorder and the use of it?
  2. Task.Run(() => { Processor.UpdateDownloadProgress(); }); - Please share the namespace or assembly reference for the processor and the use of it?

Regards,
Yathavakrishnan M


Loader.
Up arrow icon