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

RadWindow throws NullReferenceException

12 Answers 248 Views
Window
This is a migrated thread and some comments may be shown as answers.
paul
Top achievements
Rank 1
paul asked on 07 Nov 2008, 04:41 PM
Hi,

I've just updated our application to use the q3 release, and we are getting an exception after showing the window.

We are using RadMenu in the parent control, and we create instances of our custom control which inherits from RadWindow whcih includes RadComboBox's.

I'm not sure how to go about debugging this issue.

"Unhandled Error in Silverlight 2 Application
Code: 4004    
Category: ManagedRuntimeError       
Message: System.NullReferenceException: Object reference not set to an instance of an object.
   at Telerik.Windows.Controls.RadWindow.GetParentRadWindow(DependencyObject child)
   at Telerik.Windows.Controls.RadWindow.OnLostFocus(RoutedEventArgs e)
   at System.Windows.Controls.Control.OnLostFocus(Control ctrl, EventArgs e)
   at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, String eventName)  

Regards,

Paul Chapman 
"

12 Answers, 1 is accepted

Sort by
0
Jeremy
Top achievements
Rank 1
answered on 07 Nov 2008, 09:42 PM

We are running into this same issue (Null Reference Exception at Telerik.Windows.Controls.RadWindow.GetParentRadWindow(DependencyObject child)

We have an extended RadWindow xaml (for base behavior of our windows) and are instantiating the extended RadWindow, setting the content of the instantiated object, and then calling Show() (or ShowDialog()).  The content within the RadWindow is a UserControl with a Grid as the root control.

This functionality worked when using the RC1 binaries, however we upgraded to the Q3 Trial release today and began having this issue.

Thank you for your help.
- Jeremy

0
Valentin.Stoychev
Telerik team
answered on 08 Nov 2008, 11:55 AM
Hello Paul, Jeremy,

We will research this problem and will provide you with a solution in the coming days. We have another scheduled release this week, so will try to fix the problem until then.

Thanks for your feedback!


Greetings,
Valentin.Stoychev
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Bichitra
Top achievements
Rank 1
answered on 10 Nov 2008, 11:52 PM
Hi,

I have the same problem with new version, It would be better to send a mail to all user,as you are releasing new version.
Really It is also breaking to previous version with RadWindow control. closing event is removed.

Thanks
Bichitra
0
Hristo Borisov
Telerik team
answered on 11 Nov 2008, 07:32 AM
Hello Bichitra,

We are currently resolving the issues, thus you will have it fixed for the new release.

Our policy dictates that breaking changes shouldn't be introduced after an official version is released. Until now we have had only beta versions which means that we don't guarantee that one beta will work with a later one. From now on, since we have had an official release of Silverlight 2 control, we will mark all classes and methods obsolete in case they won't be used or will be subject to change in the later versions. I am sorry again for the caused inconvinience.

Regards,
Hristo Borisov
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Hristo Borisov
Telerik team
answered on 11 Nov 2008, 07:47 AM
Hello Paul, Jeremy,

It seems that both of you are experiencing the same issue. Unfortunately, we cannot reproduce your problem, that is why I would like you to send us a simple solution with the inherited RadWindow and your UserControl in which you are getting the exceptions so that I can research the problem better. Thank you for your patience.

Kind regards,
Hristo Borisov
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Hristo Borisov
Telerik team
answered on 11 Nov 2008, 08:16 AM
Hi Paul, Jeremy,

Ignore my last post, I managed to resolve the unhandled error you were getting, so look forward to downloading our latest bits.

All the best,
Hristo Borisov
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Kalle
Top achievements
Rank 1
answered on 17 Nov 2008, 03:38 PM
Hi!

We are facing this issue with tabcontrol (that has our custom control in it).

Any estimate when the fix will be available? This is currently causing semi-blocker issue.


Br,

Kalle
0
mlhkml
Top achievements
Rank 1
answered on 24 Nov 2008, 09:58 PM
I have the same NullReferenceException.
I linked a simple demonstration to show my prgramming architecture to use RadWindow control.
www.mktekin.com/demo/demo.rar
Unfortunately, after page loading, when I try to click on window, I faced an unexpected error.

Melih Kemal TEKÄ°N
InEduSo, California
0
Hristo Borisov
Telerik team
answered on 25 Nov 2008, 07:30 AM
Hi Melih and Kalle,

Melih,I downloaded your demo project and the version of the assembly you are using is from our official Q3 release. Since then we have introduced a new release on November 17 (SP1) that fixes some small issues mostly regarding the control templates of our controls. I advice you to download the latest version and check the release history on our website.

Kalle, are you using the latest version? If yes, please send us a sample project or code snippet and the error message so we can research the problem further.

Thank you for your feedback, and feel free to contact us if you have any further questions.

Regards,
Hristo Borisov
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Kalle
Top achievements
Rank 1
answered on 25 Nov 2008, 07:32 AM
Hi!

I believe our issue was resolved with the latest update.

Will doublecheck and update here if it still persists.

Br,

Kalle
0
Virendrasinh
Top achievements
Rank 1
answered on 20 Dec 2014, 05:13 AM
I have same problem of RadWindow throws NullReferenceException.
I have attached sample code.

Thanks
Virendrasinh
0
Polya
Telerik team
answered on 24 Dec 2014, 12:38 PM
Hello Virendrasinh,

The NullReferenceException is thrown when you are trying to set the Value of the txt_Name and txt_Address. They are in the UserControl1 that is placed inside the SampleWin RadWindow.
You are calling the RadButton_Click_2 method with the instance of Page1, but the UserControl1 is not in the VisualTree of the Page1, it is in the VisualTree of the SampleWIn RadWindow, thus it cannot be found. This leads to SampleUC in RadButton_Click_2 to be null and trying to set
SampleUC.txt_Name.Text = "";
SampleUC.txt_Address.Text = "";
causes NullReferenceException.

I suggest passing the RadWindow instance instead of the Page1 instance in RadButton_Click_2:
RadButton_Click_2(this.sampleWin, new RoutedEventArgs());
Then find the txt_Name and txt_Address using FindVisualChildren method.

I've prepared a sample project using this approach.
Please fin it attached.

Regards,
Polya
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
Window
Asked by
paul
Top achievements
Rank 1
Answers by
Jeremy
Top achievements
Rank 1
Valentin.Stoychev
Telerik team
Bichitra
Top achievements
Rank 1
Hristo Borisov
Telerik team
Kalle
Top achievements
Rank 1
mlhkml
Top achievements
Rank 1
Virendrasinh
Top achievements
Rank 1
Polya
Telerik team
Share this question
or