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

RadPane.RemoveFromParent() exception

6 Answers 144 Views
Docking
This is a migrated thread and some comments may be shown as answers.
Vladimir
Top achievements
Rank 1
Vladimir asked on 23 Jan 2015, 09:56 PM
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);
}

6 Answers, 1 is accepted

Sort by
0
Vladi
Telerik team
answered on 27 Jan 2015, 12:11 PM
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.

 
0
Vladimir
Top achievements
Rank 1
answered on 27 Jan 2015, 03:23 PM
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

0
Vladi
Telerik team
answered on 28 Jan 2015, 02:14 PM
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.

 
0
Tobias
Top achievements
Rank 1
answered on 12 Feb 2015, 01:43 PM
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?
0
Tobias
Top achievements
Rank 1
answered on 12 Feb 2015, 04:06 PM
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();
}

0
Kalin
Telerik team
answered on 13 Feb 2015, 08:34 AM
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.

 
Tags
Docking
Asked by
Vladimir
Top achievements
Rank 1
Answers by
Vladi
Telerik team
Vladimir
Top achievements
Rank 1
Tobias
Top achievements
Rank 1
Kalin
Telerik team
Share this question
or