RadDropDownButton: NullReferenceException

7 posts, 1 answers
  1. Dominic
    Dominic avatar
    15 posts
    Member since:
    May 2012

    Posted 16 Dec 2015 Link to this post

    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;
                                                }
                                            });
                        }
                    }
            }
    }

             

  2. Peshito
    Admin
    Peshito avatar
    496 posts

    Posted 17 Dec 2015 Link to this post

    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
  3. DevCraft banner
  4. Dominic
    Dominic avatar
    15 posts
    Member since:
    May 2012

    Posted 11 Apr Link to this post

    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()"

     

     

  5. Peshito
    Admin
    Peshito avatar
    496 posts

    Posted 13 Apr Link to this post

    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.
  6. Dominic
    Dominic avatar
    15 posts
    Member since:
    May 2012

    Posted 21 Apr in reply to Peshito Link to this post

    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

     

     

     

  7. Answer
    Peshito
    Admin
    Peshito avatar
    496 posts

    Posted 25 Apr Link to this post

    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.
  8. Dominic
    Dominic avatar
    15 posts
    Member since:
    May 2012

    Posted 2 days and 4 hours ago Link to this post

    Hello Peshito,

     

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

    The bug didn´t occur anymore in our program.

     

    Thanks

Back to Top
DevCraft banner