9

I've created a C++ UWP Windows 10 app using Visual Studio 2015. However, I'm not able to visualize any xaml in the designer because I'm always getting a System.NullReferenceException error. How can I fix this?

Jeffrey Chen
  • 4,650
  • 1
  • 18
  • 22
Jano
  • 731
  • 7
  • 18

5 Answers5

12

That's very odd but I solved following these steps:

  1. Close any instance of Visual Studio
  2. Open Visual studio and create a new C# UWP empty project (name it as you like, do not matter)
  3. Run the "useless" created project then close it as Visual Studio
  4. Open again your previous C++ UWP project

In my case everything started working!

Jano
  • 731
  • 7
  • 18
  • Please accept your own answer, if it solves your question. I guess the issue exists due to some packages that only get "installed"/pulled, when you use a C# UWP project? – Stefan Over Aug 03 '15 at 14:53
  • 2
    It worked for me as well. It is odd but thanks for the tip! :) – Uraza Aug 03 '15 at 16:50
  • 1
    I have the same problem, only the other way around. I want to create a C# universal app, but the designer won't load. I tried your fix in reverse (created a c++ dummy project), but in my case it didn't work. :( – Tenshiko Aug 04 '15 at 08:37
  • @Tenshiko Have you found any way to solve xamldesigner issue – Sebastian Aug 12 '15 at 06:15
  • Yep, turned out that an environment variable caused my problem. Here's my question with the accepted answer: http://stackoverflow.com/questions/31728169/visual-studio-2015-community-designer-shows-nullreferenceexception-for-blank-u – Tenshiko Aug 12 '15 at 10:32
  • This explains what happens: [link](https://social.msdn.microsoft.com/Forums/en-US/59ee2840-4329-413a-80ce-5c6a2f1390cc/rtm-known-issue-opening-a-xaml-page-from-a-c-uwp-in-visual-studio-2015-may-cause-the-xaml?forum=Win10SDKToolsIssues) – Sergey Aug 23 '15 at 21:11
  • The XAML designer crashing with a NullReferenceException is a known issue/bug with VS 2015 RTM: https://social.msdn.microsoft.com/Forums/en-US/59ee2840-4329-413a-80ce-5c6a2f1390cc/rtm-known-issue-opening-a-xaml-page-from-a-c-uwp-in-visual-studio-2015-may-cause-the-xaml?forum=Win10SDKToolsIssues – Prashant H Phadke - MSFT Aug 25 '15 at 19:58
1

Switching solution platform to x86 worked for me.

BorisT
  • 138
  • 7
0

I'm experiencing exactly the same problem on my primary development machine but not on another. The reason is... I think... When I installed Visual Studio 2015 on the 2nd machine, the first time I created a Universal Solution (C#) I was shown a dialog asking me to OK "elevated permissions" (custom permissions) for the VS2015 installation folder. I OK'd it and Designer works on that machine in both Blend2015 and VS2015 (community edition)

On the other machine I was never shown the dialog asking me to confirm elevated permissions and Designer does NOT work on that machine (VS2015 Enterprise). This machine also has VS2013 update 5) on it.

I am thinking that I might have to completely wipe off VS2015 and try to clean the registry of all VS2105 references AND remove the VS2015 installation directories on C:\ AND when I reinstall, create a installation directory with a different name (if I can). What a PAIN though... I'm waiting to see if MS delivers a simple solution since I'm quite positive that this whole issue boils down to a bug (feature... grrr) having to do with custom permissions that can't be changed (or added) after installation.

Would be nice is MS would confirm this... (please note, none of this involved c++... it was all C#)

Tom

this is the dialog I was shown on the machine where Designer works![enter image description here]1

Tom
  • 21
  • 1
0

Installing the Windows Software Development Kit (SDK) for Windows 10 solved the issue for me. It may ask to unistall the previous version of Windows 10 RTM SDK

https://developer.microsoft.com/en-us/windows/downloads/windows-10-sdk

YouneS
  • 390
  • 4
  • 10
-2

This is fixed in Update 1 of Visual Studio 2015

https://www.microsoft.com/en-us/download/details.aspx?id=49989