This is a migrated thread and some comments may be shown as answers.

RadDropDownButton: NullReferenceException

7 Answers 96 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Dominic
Top achievements
Rank 1
Dominic asked on 16 Dec 2015, 02:41 PM

Hello,

somtimes get the following NullReferenceException in RadDropDownButtons:

1.Der Objektverweis wurde nicht auf eine Objektinstanz festgelegt.
2.StackTrace:
3.   bei Telerik.Windows.Controls.RadDropDownButton.<>c__DisplayClass2.<OnLoaded>b__0()


We were puzzled and surprised, because we did not change anything and we have no idea why this occurs. the stacktrace is also very short and does not show from where it comes.
Looking at the Sourcecode we probably found the bug. There is a Dispatcher call without checking in the dispatcher call for NULL.

namespace Telerik.Windows.Controls
{
    [TelerikToolboxCategory("Navigation")]
    public class RadDropDownButton : RadButton, IPopupHost, IPopupWrapperOwner, IDisposable
    {
     
                private void OnLoaded(object sender, RoutedEventArgs e)
                {
                    this.isLoaded = true;
                    RadDropDownButton isOpen = sender as RadDropDownButton;
                    if (isOpen != null && isOpen.popupWrapper != null)
                    {
                        base.Dispatcher.BeginInvoke(() => isOpen.popupWrapper.IsOpen = this.IsOpen);
                    }
                }
        }
}
 
Please fix it like this:
 
namespace Telerik.Windows.Controls
{
    [TelerikToolboxCategory("Navigation")]
    public class RadDropDownButton : RadButton, IPopupHost, IPopupWrapperOwner, IDisposable
    {
     
                private void OnLoaded(object sender, RoutedEventArgs e)
                {
                    this.isLoaded = true;
                    RadDropDownButton isOpen = sender as RadDropDownButton;
                    if (isOpen != null && isOpen.popupWrapper != null)
                    {
                        base.Dispatcher.BeginInvoke(
                            () => {
                                            if(isOpen.popupWrapper != null
                                            {
                                                    isOpen.popupWrapper.IsOpen = this.IsOpen;
                                            }
                                        });
                    }
                }
        }
}

         

7 Answers, 1 is accepted

Sort by
0
Peshito
Telerik team
answered on 17 Dec 2015, 08:25 AM
Hi Dominic,

Thank you for pointing that out. In order to confirm this as a bug we need to be able to reproduce it first. That is why I would like to ask you to provide a sample runnable project demonstrating the issue. In the meantime I will forward your solution to our developers for further consideration.

Regards,
Peshito
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Dominic
Top achievements
Rank 1
answered on 11 Apr 2016, 09:40 AM

Hello Peshito,

did you implement our fix? 

We still get the error daily a dozend times. The error is obvoius and trivial to fix, so please provide the fix to the devs.

"Der Objektverweis wurde nicht auf eine Objektinstanz festgelegt.
StackTrace:
   bei Telerik.Windows.Controls.RadDropDownButton.<>c__DisplayClass2.<OnLoaded>b__0()"

 

 

0
Peshito
Telerik team
answered on 13 Apr 2016, 08:19 AM
Hello Dominic,

Please provide us with a sample project reproducing the issue. After doing so we will be able to confirm the bug, log it in our public feedback portal and consider it for one of our future releases.

Regards,
Peshito
Telerik
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
0
Dominic
Top achievements
Rank 1
answered on 21 Apr 2016, 11:33 AM

Hello,

 

sorry, we have no sample, reproducing the issue, it depends on timing (because it occurs in a dispatcher call)

It only occurs in our huge production code somtimes, not in any sample we tried.

 

But for what do you need a reproduction case? - I posted the code with error and a fix for the error, it is just an missing If-Statement, its no work to fix this.

Please providethe code iI posted to the developers, or show them our code fix.

I think they will confirm, there is a potential issue in the original  code.

Regards,

Dominic

 

 

 

0
Accepted
Peshito
Telerik team
answered on 25 Apr 2016, 08:50 AM
Hello,

I logged this issue in our public feedback portal. It will be considered for one of our upcoming releases. Please use the link below to track the progress of the item and to vote for it in order to raise its priority.
http://feedback.telerik.com/Project/143/Feedback/Details/189924-nullreferenceexception-in-dispatcher-call

Regards,
Peshito
Telerik
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
0
Dominic
Top achievements
Rank 1
answered on 02 Dec 2016, 01:40 PM

Hello Peshito,

 

I saw, that the bug was fixed already in the newest versions.

The bug didnĀ“t occur anymore in our program.

 

Thanks

0
Accepted
Peshito
Telerik team
answered on 05 Dec 2016, 08:20 AM
Hello Dominic,

This issue was fixed with the R3 2016 SP release. I am glad it does not appear in your application anymore.

Thank you for your feedback.

Regards,
Peshito
Telerik by Progress
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
Tags
General Discussions
Asked by
Dominic
Top achievements
Rank 1
Answers by
Peshito
Telerik team
Dominic
Top achievements
Rank 1
Share this question
or