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

9 posts, 0 answers
  1. Eugene
    Eugene avatar
    83 posts
    Member since:
    Jan 2016

    Posted 22 Apr 2016 Link to this post

    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.
  2. Milena
    Admin
    Milena avatar
    226 posts

    Posted 25 Apr 2016 Link to this post

    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.
  3. Eugene
    Eugene avatar
    83 posts
    Member since:
    Jan 2016

    Posted 25 Apr 2016 in reply to Milena Link to this post

    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.
  4. Joel Palmer
    Joel Palmer avatar
    175 posts
    Member since:
    May 2009

    Posted 20 Feb Link to this post

    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.

  5. Joel Palmer
    Joel Palmer avatar
    175 posts
    Member since:
    May 2009

    Posted 20 Feb Link to this post

    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.
  6. Joel Palmer
    Joel Palmer avatar
    175 posts
    Member since:
    May 2009

    Posted 20 Feb in reply to Joel Palmer Link to this post

    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

  7. Milena
    Admin
    Milena avatar
    226 posts

    Posted 22 Feb Link to this post

    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.
  8. Joel Palmer
    Joel Palmer avatar
    175 posts
    Member since:
    May 2009

    Posted 06 Mar in reply to Milena Link to this post

    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.

  9. Martin Ivanov
    Admin
    Martin Ivanov avatar
    1442 posts

    Posted 08 Mar Link to this post

    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.
Back to Top