Completed
Last Updated: 05 Feb 2024 13:49 by ADMIN
Release 2024 Q1 (2024.1.130)
Maheswari
Created on: 20 Sep 2023 11:05
Category: DropDownList
Type: Bug Report
0
RadDropDownList: StackOverflowException is thrown when setting SelectedValue to a value on the same index in the SelectedIndexChanged event

StackOverflowException is thrown when setting SelectedValue in the SelectedIndexChanged event.

To workaround this we can unsubscribe from the event before setting the SelectedValue property and then subscribe again. Another approach is to change the SelectedIndex property in the SelectedIndexChanged or SelectedValue in the SelectedValueChanged event.

9 comments
ADMIN
Dinko | Tech Support Engineer
Posted on: 05 Feb 2024 13:49

Hello Maheswari,

I appreciate the provided project and thank you for your patience. We needed some time to investigate and confirm your last reported exception.

Upon checking the project, indeed the same StackOverflow exception is raised. However, this exception comes from setting the DataSource property in the SelectedIndexChanged event of the control. The initial reported behavior here is related to setting the SelectedValue property in the SelectedIndexChanged event. The last reported exception is quite different and it is not related to the initial one discussed here.

In general, it is not a common scenario in which the DataSource is changed in its SelectedIndexChanged event. We have compared this behavior with the MS ComboBox and such an exception is not raised in the control while executing the same logic. In the MS ComboBox control setting the DataSource in a selection change event will trigger the event again, however, the control internally checks for such a scenario and the DataSource is not reset in the same process cycle. I can agree that we also could handle this internally. That is why I have logged it in our Feedback Portal on your behalf where you can track its progress and follow the item. I have already forwarded this to our development team and I was just informed that they are working on providing a fix. 

In the meantime, what I can suggest as a workaround is to raise a flag before changing the DataSource. You can check this flag in the SelectedIndexChanged event before calling the reset data source method.

bool isDataSourceChangeInProgress1 = false;
bool isDataSourceChangeInProgress2 = false;
bool isDataSourceChangeInProgress3 = false;
private void radDropDownList1_SelectedIndexChanged(object sender, Telerik.WinControls.UI.Data.PositionChangedEventArgs e)
{
    if (!isDataSourceChangeInProgress1)
    {
        fillIndustryProcess1();
    }
    //Still stack overflow exception occurring when setting the data source to the radDropDownList
}
public void fillIndustryProcess1()
{
    try
    {
        isDataSourceChangeInProgress1 = true;
        System.Data.DataTable dt = new System.Data.DataTable();
        dt.Columns.Add("Industry", typeof(string));
        dt.Columns.Add("ID", typeof(int));
        dt.Rows.Add("BGL-0", 0);
        dt.Rows.Add("BGL-1", 1);
        dt.Rows.Add("BGL-2", 2);
        dt.Rows.Add("BGL-3", 3);
        dt.Rows.Add("BGL-4", 4);
                
        radDropDownList1.DisplayMember = "Industry";
        radDropDownList1.ValueMember = "ID";
        radDropDownList1.DataSource = dt;//Still stack overflow exception occurring when bind the radDropDownList
        radDropDownList1.SelectedIndex = 0;
        isDataSourceChangeInProgress1 = false;
    }
    catch (System.ComponentModel.Win32Exception ex)
    {
        throw ex;
    }
}

I am also attaching the updated version of your project.

In addition, I have increased your Telerik Points for bringing this scenario to our attention.

Regards,
Dinko | Tech Support Engineer
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.

Attached Files:
Maheswari
Posted on: 01 Feb 2024 05:45

Hi Dinko,

I tested the version telerik 2024.1.130 with visual studio 2022 application however the stack overflow exception is not yet resolved.

As I said , our application requirement is to bind the Raddropdownlist will happened inside the selectedIndex event. Not only the SelectedValue is doing the recursive call moreover when we set datasource to Raddropdownlist also the recursive call is occurring. This information I have provided in my previous forums before you raise ticket for this issue.

Could you please reopen the issue and fix for Datasource recursive calls also and test whether it is working for below items in the SelectedIndexChanged Event Liike telerik 2010 raddropdownlist?

Bind the raddropdownlist,

Set the SelectedValue

Set the SelectedIndex

 

We are waiting for your fixed dll to continue further.

I have attached my sample application again for reference.

 

Thanks,

Maheswari

Attached Files:
Maheswari
Posted on: 27 Nov 2023 12:53

Hi Dinko,

Thank you for your tremendous response. Let us wait for the latest Telerik dll.

 

Thanks,

Maheswari

 

ADMIN
Dinko | Tech Support Engineer
Posted on: 27 Nov 2023 10:35

Hello Maheswari,

I am happy to inform you that the item status was changed to In Development. This means that the team is working on providing a fix. As soon as the development team is ready with the fix, we will update the feedback item with additional information on which version this fix will be available.

I will keep you informed regarding their progress.

Regards,
Dinko | Tech Support Engineer
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.

Maheswari
Posted on: 23 Nov 2023 08:59

Hi Dinko,

As you said the ticket was created and When the fix will be provided. I could not see tickets in my account, it is disappeared and in top tap it is showing unplanned.

Pls suggest So that we can buy the license.

Thanks,

Maheswari

 

ADMIN
Dinko | Tech Support Engineer
Posted on: 26 Sep 2023 10:15

Hello Maheswari,

 I understand this behavior is important for you. So far this item is not planned for fixing. We are currently working on tasks for the upcoming release which is scheduled for the beginning of October. I have increased the priority of the item so that our development team could consider this for fixing sooner.

As for canceling the SelectedIndexChanging event, I have replied to your case in the forum thread. We can continue there.

Regards,
Dinko | Tech Support Engineer
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.

Maheswari
Posted on: 22 Sep 2023 05:57

Hi Dinko,

 

As I mentioned in previous forum , we are expecting Telerik 2023 latest dll which should resolve the recursive call stachoverflow issue.

If  that stackoverflow issue fixed from your end then only we can buy the license for Telerik 2023.

My manager asked to check with you, when you can give the new Telerik 2023 dll files?

If you provide new dll internally to us then we can test and confirm after that only we can buy license from your end.

 If the process complete by next week then it would be grateful else we need to think alternate options which is workable.

Please suggest.

 

Thanks,

Maheswari

Maheswari
Posted on: 21 Sep 2023 06:09

Hi Dinko,

 

Tried the workaround which is suggested by you and team in previous forums.

public static void cmbTelerik_SelectedIndexChanging(object sender, Telerik.WinControls.UI.Data.PositionChangingCancelEventArgs e)
        {
            if (e.Position == -1)
            { e.Cancel = true; }

            RadDropDownList dropdown = (RadDropDownList)sender;
               if (isDataSourceFill || isIndexChanged || (previousValue == dropdown.SelectedValue && previousValue != null) || previousSelectedIndex == 0 || (previousSelectedIndex != -1 && previousSelectedIndex == dropdown.SelectedIndex))       
                {
  e.Cancel = true; // This is now throwing stack overflow
                }
                previousValue = dropdown.SelectedValue;
                previousSelectedIndex = dropdown.SelectedIndex;          
             }
    }

 

So in Telerick 2023 for cancel event itself  it is throwing Stack over flow.

And also tried to override the SelectedValue propety

 public override object SelectedValue
            {
                get; set;
                //get
                //{
                //      return dropDownListElement.SelectedValue;
                //}
                //set
                //{
                //    dropDownListElement.SelectedValue = value;
                //   // OnNotifyPropertyChanged("SelectedValue");
                //}
            }

Somehow the SOE is not occurring however the values of the dropdown resetting to default.

 

Hence

 

We are expecting for your latest Telerik 2023 dll. When it will be resolved and will you release?

If you expedite the process that would be grateful.

 

Please suggest.

 

Thanks,

Maheswari

 

 

 

 

                 
ADMIN
Dinko | Tech Support Engineer
Posted on: 20 Sep 2023 11:09

Hello Maheswari,

Thank you for reporting this.

Regards,
Dinko | Tech Support Engineer
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.