RadPane.RemoveFromParent() exception

7 posts, 0 answers
  1. Vladimir
    Vladimir avatar
    2 posts
    Member since:
    Aug 2014

    Posted 23 Jan 2015 Link to this post

    RadPane.RemoveFromParent() sometimes throws null reference exception.

    It appears that there is a typo in RadPane.cs, RemoveFromParent() method. 
    In the if statement you should check if this.PaneGroup !=null (with capital 'P').

    i.e. instead of:
    if (this.paneGroup != null)
    {
        this.PaneGroup.RemovePane(this);
    }

    do:
    if (this.PaneGroup != null)
    {
       this.PaneGroup.RemovePane(this);
    }
  2. Vladi
    Admin
    Vladi avatar
    744 posts

    Posted 27 Jan 2015 Link to this post

    Hello Vladimir,

    Thank you for contacting us and bringing this to our attention.

    We reviewed the mentioned code and indeed it looks like it has a typo error. We have already implemented a fix for it and it is being tested by our QA team as we speak. If all goes well the fix should be available in our next internal. As we weren't able to observe the scenario on our side could you described to us in more details the required steps which lead to an exception when calling the RamoveFromParent method. This would help us validate all of the use cases where the typo could be leading to an issue in the RadDocking control.

    I updated your Telerik points for bringing this to our attention. If we can be if any further assistance please let us know.

    Regards,
    Vladi
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  3. UI for WPF is Visual Studio 2017 Ready
  4. Vladimir
    Vladimir avatar
    2 posts
    Member since:
    Aug 2014

    Posted 27 Jan 2015 in reply to Vladi Link to this post

    It happens under the following scenario:
    1. Create a docking control that binds to PanesSource:
    <telerik:RadDocking Name="RadDocking" Grid.Row="3" PanesSource="{Binding Panes}" >
      <telerik:RadDocking.DockingPanesFactory>
         <telerik:DockingPanesFactory/>
       </telerik:RadDocking.DockingPanesFactory>
    </telerik:RadDocking>

    2. Subscribe to Close() event to be notified when panes are closed:
    this.RadDocking.Close += RadDocking_Close;

    3.  Add the following handler (note that "panes" is the ObservableCollection that docking control is bound to):
    void RadDocking_Close(object sender, StateChangeEventArgs e)
    {
    e.Panes.ForEach(pane =>
       {
           panes.Remove(pane);
           pane.RemoveFromParent();
       });


    Now add and close a pane; exception will be thrown. 

    "pane.RemoveFromParent();" throws exception.  Note that if you first call "pane.RemoveFromParent();" and then panes.Remove(pane);" a different exception is thrown.

    thanks,
    Vlad

  5. Vladi
    Admin
    Vladi avatar
    744 posts

    Posted 28 Jan 2015 Link to this post

    Hi Vladimir,

    Thank you for providing the additional information.

    We will make sure to have it in mind when further resolving this issue.

    Regards,
    Vladi
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  6. Tobias
    Tobias avatar
    8 posts
    Member since:
    Aug 2011

    Posted 12 Feb 2015 in reply to Vladi Link to this post

    I get the same exception as described by Vladimir.
    I checked the source for version 2014.2.0729 and the typo is still there.
    When do you think the typo will be fixed in a public release?
  7. Tobias
    Tobias avatar
    8 posts
    Member since:
    Aug 2011

    Posted 12 Feb 2015 in reply to Tobias Link to this post

    I realized now that I wrote wrong version number in my last reply (why is edit or delete of forum posts not supported?).

    But the typo is there in the latest 2014.3.1202 so the question is still relevant.

    For other people having this issue a workaround to the issue is easy, add your own correct null-check:

    if (pane.PaneGroup != null)
    {
        pane.RemoveFromParent();
    }

  8. Kalin
    Admin
    Kalin avatar
    1208 posts

    Posted 13 Feb 2015 Link to this post

    Hi Tobias,

    Currently the fix is available with the latest internal build, so you can test it. If you need official release - the fix will be present in the next release - Q1 2015.

    Hope this helps.

    Regards,
    Kalin
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
Back to Top
UI for WPF is Visual Studio 2017 Ready