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

RadTreeView generates an error: "object reference not set to an instance of an object" in XAML.

8 Answers 407 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Eugene
Top achievements
Rank 1
Eugene asked on 22 Apr 2016, 06:01 AM
I try to use RadTreeView in my WPF MVVM Prism 6 application project. But when I put RadTreeView in UserControl area then it is underlined with blue wavy line and if I move the mouse cursor to this line the next error message is displayed: "Object reference not set to an instance of an object". I've added references to the following assemblies: Telerik.Windows.Controls, Telerik.Windows.Controls.Navigation, Telerik.Windows.Controls.Data. But I have the abovementioned error. What the reason of it. Please help me eliminate this error situation.

8 Answers, 1 is accepted

Sort by
0
Milena
Telerik team
answered on 25 Apr 2016, 07:24 AM
Hi Eugene,

I am sorry to hear about the issues you are experiencing.

Could you tell us if this error message is visible only in design time and you can run the project without throwing exception at runtime? 

One of the possible reasons for seeing this error message could be the cache which is created by the Visual Studio, so you can try to:
1. clean and rebuild the project. 
2. or delete manually the bin and obj folders then rebuild the project  - this will ensure that all unnecessary files will be deleted.

If the issue is connected to the Visual Studio designer, you can also do the following:
1) close all visual studio instances.
2) go to  C:\Users\<username>\AppData\Local\Microsoft\VisualStudio\<visual_studio_version,for_example_12.0>\Designer\ShadowCache and delete the folders there - this is the cache of VisualStudio's designer.

If none of this helps, we will need more detailed information to further investigate the reasons behind the behavior (e.g. the version of your Visual Studio, if you are using third party extensions for Visual Studio, etc.). Also it would be great if you could send us an isolated project  where the issue appears. This will allow us to test it and further investigate the case.

I am looking forward to helping you solve this issue.

Regards,
Milena
Telerik
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
0
Eugene
Top achievements
Rank 1
answered on 25 Apr 2016, 01:03 PM
This error message disappeared when I add next control in XAML after RadTreeView. But today morning it appeared just after XAML markup had been loaded. But after I cleaned and rebuilt the solution the error message "Object reference not set to an instance of an object" about RadTreeView was disappeared.
0
Joel Palmer
Top achievements
Rank 2
answered on 20 Feb 2017, 03:46 PM

So, I deleted the bin and the obj folders and ended up with 35 errors even after a rebuild.  So then I performed another clean and opened the bin directory and made sure that was empty again.  On rebuild after the clean I landed back on 3 errors.  I then performed a Telerik Upgrade Wizard to resolve the reference error and even though that wizard did find something to change the error still didn't go away.  So then I went and deleted the Telerik.Windows.Controls reference off the project so I can re-add it fresh.  I went to the add-reference and discovered that nothing from Telerik were listed.  I went to the Toolbox to see if Telerik is listed there an it is.  So... it looks like I need to uninstall and reinstall Telerik.

0
Joel Palmer
Top achievements
Rank 2
answered on 20 Feb 2017, 03:52 PM
So, what is interesting is that before doing the reinstall I rebuilt the application without the Telerik.Windows.Controls reference and the Object Reference error is gone.  These are the errors I now have... which tells me there is a problem with your Telerik.Windows.Controls .dll.
0
Joel Palmer
Top achievements
Rank 2
answered on 20 Feb 2017, 05:14 PM

After uninstalling and reinstalling the WPF suite, the references now show up under "extensions".  So, I added the Telerik.Windows.Controls reference back to the project.  However, the Object Reference errors are also back.  Let me know when someone can connect to review this.  These errors are not yet holding up a project... but, we're getting close.  I need this resolved within the week.

Thanks for your help,

Joel

0
Milena
Telerik team
answered on 22 Feb 2017, 01:48 PM
Hello Joel, 

Thank you for the pictures provided. 

I would like to ask you some questions related to the error messages: 
- could you check if all telerik binaries are from the same version, and tell us if they are xaml or noxaml. You can check this when right click on e.g. Telerik.Windows.Controls.dll, choose Properties -> Details tab (see attached picture);
- I saw that you are using Visual Studio 2015, could you tell us which version;
- If you are using Visual Studio 2015 deleting bin and obj folders is not enough, you need to close the solution file and delete .vs folder, sometimes this helps to remove old error messages; 
- are you using some third party extensions for Visual Studio or code analysis tool; 

However, I think that it would be better if you could send us a sample project where we can reproduce the issue, because I think that something from the project setup could affect this behavior (because some of the messages are related to the project context). 

Thank you in advance for your cooperation.

Regards,
Milena
Telerik by Progress
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
0
Joel Palmer
Top achievements
Rank 2
answered on 06 Mar 2017, 06:39 PM

Been very busy so I haven't had a chance to respond.  However, the error continues.  If you are unable to reproduce this then I suggest you and I set up a remote session to work through this.

-Yes, I use all XAML controls.  No exceptions.

-I use the latest version of Visual Studio (14.0.25431.01 Update 3)

-I use only Telerik, Microsoft and WiX (installer by .NET Foundation)  extensions.

0
Martin Ivanov
Telerik team
answered on 08 Mar 2017, 11:07 AM
Hello Joel,

Thank you for the provided information so far. I checked it and I think there is a still one question that I couldn't find answered. Does the errors appear only at design-time and do they prevent the application from running?

Note that such issues are very common in big projects with many assembly references and they can appear because variety of reasons. I prepared a small step by step troubleshooting list based on the information given in all the previous replies. Please give it a try and see if there is any difference.
  • Double check the version of the Telerik dlls. This includes 3 key factors - .net version, version of the UI for WPF suite and Xaml/NoXaml version.

    - All UI for WPF assemblies must be of the same version.
    - All UI for WPF assemblies must have the same (or lower) .NET version as the Target framework of the project. You can check this from the Properties tab of the Visual Studio project.
    - All UI for WPF assemblies should be XAML or NoXaml. There are different dlls referenced in different folders in the installation folder (Binaries and Binaries.NoXaml folders). We do not recommend mixing XAML and NoXaml dlls. Make sure that only one type is referenced. Check more about this in the Setting a Theme help article.

  • Close Visual Studio.
  • Delete the "bin" and "obj" folders of the projects in your solution.
  • Delete the Visual Studio ShadowCache as explained in one of the Milena's previous replies.
  • Start Visual Studio.
  • Clean and Rebuild the solution.
Also, can you tell me if this is reproducible only with RadTreeView or you can recreate it with any other control?

If the given information doesn't help I would ask you to open a new support ticket from your telerik.com account and attach an example project that isolates the errors. This way we will get better understanding of your implementation and investigate what is causing the errors.

Regards,
Martin
Telerik by Progress
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
Tags
TreeView
Asked by
Eugene
Top achievements
Rank 1
Answers by
Milena
Telerik team
Eugene
Top achievements
Rank 1
Joel Palmer
Top achievements
Rank 2
Martin Ivanov
Telerik team
Share this question
or