locked
[UWP]: System.NullReferenceException Object reference not set to an instance of an object. RRS feed

  • Question

  • I create a new Universal App in Visual Studio Community 2015 and this is what the designer has.  There is nothing added to the MainPage yet. I have tried this on 2 computers and can not figure out what is causing this.

    System.NullReferenceException
    Object reference not set to an instance of an object.
       at Microsoft.VisualStudio.DesignTools.Platform.Metadata.MetadataStore.GetTypeConverter(Type type)
       at Microsoft.VisualStudio.DesignTools.WindowsXamlDesigner.WindowsUIXamlDesignTimeProperties.ResolveImplementation(IPlatformMetadata platformMetadata, DesignTimePropertyId neutralProperty, IType declaringType, PropertyChangedCallback callback)
       at Microsoft.VisualStudio.DesignTools.WindowsXamlDesigner.WindowsUIXamlDesignTimeProperties.RegisterProperty(IPropertyId neutralPropertyKey, IType declaringType, PropertyChangedCallback callback)
       at Microsoft.VisualStudio.DesignTools.WindowsXamlDesigner.WindowsUIXamlCommonDesignTimeProperties.Initialize(WindowsUIXamlDesignTimeProperties designTimeProperties)
       at Microsoft.VisualStudio.DesignTools.WindowsXamlDesigner.WindowsUIXamlDesignTimeProperties..ctor(IPlatformTypes platformMetadata)
       at Microsoft.VisualStudio.DesignTools.UniversalXamlDesigner.UniversalXamlPlatformMetadata.CreateDesignTimeProperties()
       at Microsoft.VisualStudio.DesignTools.WindowsXamlDesigner.Metadata.WindowsUIXamlPlatformMetadata.Initialize()
       at Microsoft.VisualStudio.DesignTools.WindowsXamlDesigner.WindowsStoreXamlPlatform.Initialize()
       at Microsoft.VisualStudio.DesignTools.Platform.PlatformCreatorBase.CreatePlatform(IPlatformReferenceAssemblyResolver referenceAssemblyResolver)
       at Microsoft.VisualStudio.DesignTools.Designer.Project.ProjectContextManager.GetProjectContext(IHostProject project, IPlatform platform, Boolean create)
       at Microsoft.VisualStudio.DesignTools.Designer.Project.ProjectContextManager.GetSourceItemContext(IHostSourceItem sourceItem)
       at Microsoft.VisualStudio.DesignTools.Designer.DesignerService.CreateDesigner(IHostSourceItem item, IHostTextEditor editor, CancellationToken cancelToken)
       at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.RemoteDesignerService.<>c__DisplayClass12_0.<Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.IRemoteDesignerService.CreateDesigner>b__0(CancellationToken cancelToken)
       at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.RemoteDesignerService.<>c__DisplayClass6_0`1.<MarshalInWithCancellation>b__0()
       at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.STAMarshaler.Call.InvokeWorker()

    System.NullReferenceException
    Object reference not set to an instance of an object.

    Server stack trace: 
       at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.STAMarshaler.WaitForCompletion(NestedCallContext nestedCallContext, BlockingCall call, WaitHandle timeoutSignal)
       at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.STAMarshaler.MarshalInSynchronous(Action action, Int32 targetApartmentId, CancellationToken cancelToken, CallModality callModality, String methodName, String filePath, Int32 lineNumber)
       at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.STAMarshaler.MarshalIn(Action action, Int32 targetApartmentId, CancellationToken cancelToken, CallSynchronizationMode syncMode, CallModality callModality, String methodName, String filePath, Int32 lineNumber)
       at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.ThreadMarshaler.MarshalIn(IRemoteObject targetObject, Action action, CancellationToken cancelToken, CallSynchronizationMode syncMode, CallModality callModality, ApartmentState apartmentState, String memberName, String filePath, Int32 lineNumber)
       at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.RemoteDesignerService.MarshalInWithCancellation[TResult](IRemoteCancellationToken remoteToken, Func`2 func, ApartmentState apartmentState)
       at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.RemoteDesignerService.Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.IRemoteDesignerService.CreateDesigner(IRemoteHostProject remoteProject, IRemoteHostSourceItem remoteItem, IRemoteHostTextEditor remoteEditor, IRemoteCancellationToken remoteToken)
       at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Object[]& outArgs)
       at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg)

    Exception rethrown at [0]: 
       at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
       at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
       at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.IRemoteDesignerService.CreateDesigner(IRemoteHostProject remoteProject, IRemoteHostSourceItem remoteItem, IRemoteHostTextEditor remoteEditor, IRemoteCancellationToken cancelToken)
       at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.LocalDesignerService.CreateDesignerImpl(IRemoteDesignerService ds, IHostSourceItem item, IHostTextEditor editor, RemoteCancellationToken remoteCancelToken)
       at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.LocalDesignerService.<>c__DisplayClass14_0.<Microsoft.VisualStudio.DesignTools.DesignerContract.IDesignerService.CreateDesigner>b__0(IRemoteDesignerService ds, RemoteCancellationToken remoteToken)
       at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.LocalDesignerService.<>c__DisplayClass5_0`1.<MarshalOutWithCancellation>b__0(IRemoteDesignerService ds)
       at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.ThreadMarshaler.<>c__DisplayClass27_0`1.<MarshalOut>b__0()
       at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.STAMarshaler.Call.InvokeWorker()

    System.NullReferenceException
    Object reference not set to an instance of an object.
       at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.STAMarshaler.WaitForCompletion(NestedCallContext nestedCallContext, BlockingCall call, WaitHandle timeoutSignal)
       at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.STAMarshaler.MarshalOutSynchronous(Action action, Int32 targetApartmentId, WaitHandle aborted, WaitHandle timeoutSignal, CancellationToken cancelToken, String methodName, String filePath, Int32 lineNumber)
       at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.STAMarshaler.MarshalOut(Action action, Int32 targetApartmentId, WaitHandle aborted, CancellationToken cancelToken, CallSynchronizationMode syncMode, WaitHandle timeoutSignal, String methodName, String filePath, Int32 lineNumber)
       at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.ThreadMarshaler.MarshalOut[TValue](RemoteHandle`1 targetObject, Action action, CancellationToken cancelToken, CallSynchronizationMode syncMode, ApartmentState apartmentState, String methodName, String filePath, Int32 lineNumber)
       at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.ThreadMarshaler.MarshalOut[TValue](RemoteHandle`1 targetObject, Action`1 action, CancellationToken cancelToken, CallSynchronizationMode syncMode, ApartmentState apartmentState, String methodName, String filePath, Int32 lineNumber)
       at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.LocalDesignerService.MarshalOutWithCancellation[TResult](CancellationToken cancelToken, Func`3 func, ApartmentState apartmentState)
       at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.LocalDesignerService.Microsoft.VisualStudio.DesignTools.DesignerContract.IDesignerService.CreateDesigner(IHostSourceItem item, IHostTextEditor editor, CancellationToken cancelToken)
       at Microsoft.VisualStudio.DesignTools.DesignerContract.IsolatedDesignerService.IsolatedDesignerView.CreateDesignerViewInfo(CancellationToken cancelToken)


    Thursday, August 13, 2015 11:18 PM

Answers

All replies

  • Samething here... Saddly, I don't have any solution to this :c

    But, I want to know if this is actually the same error:

    1) Can you make Windows/Windows Phone 8.1 Apps without problems? (I can)

    2) Did you uninstalled the "Cordova" feature? (I did)

    3) Did you install all the features that comes on VS2015Community? (I did).

    4) Did you Enabled the Developer Mode on "Update & Security" (Windows 10... I did)

    5) Did you re-installed all VS2015 Community? (I did)

    Thursday, August 13, 2015 11:32 PM
  • It appears to be the exact same problem.  I can run the app with no errors and MainPage loads.  The problem must be with the designer.  Any suggestions on how to fix this?
    • Edited by MDC3161 Friday, August 14, 2015 9:32 PM
    Thursday, August 13, 2015 11:36 PM
  • I still without any solution yet... But I read somethere that with a cleaned installation of Windows 10 (A.K.A. Format C:\) the problem dissapear itsself... The problem is that I have 1TB of information... so I can't make a clean installation for now (I don't have any HDD or partition up to 1TB free). So, if you can test it and tell us if it's works.. I'll try to make it too.
    Wednesday, August 19, 2015 4:01 PM
  • I have the same problem.  I'm hoping Microsoft will fix the problems.  The one thing I found that fixed my Desktop (Windows Home Version) was to go to System - Advanced System Settings - Advanced - Environment Variables  and removed "Platform HPD".  I do not have the same line in my two laptops that are running Windows Pro.
    Wednesday, August 19, 2015 5:03 PM
  • Maybe a bug in windows 10 SDK, you could try to reinstall SDK to see if works.
    Friday, August 21, 2015 12:39 PM
  • Thanks for the help, but I have tried that.  The one thing that I have noticed is that I have three computers, 2 windows pro and 1 home.  The home edition is the only one that works and of course I can not use Window phone emulator.  
    Friday, August 21, 2015 3:22 PM
  • Did/Do you have VS2013 before/with VS2015?

    I had VS2013 Pro and then Installed VS2015 (VS2013 stilled installed on that time), so mabye on that install a file was not installed/Updated correctly causing this problem.... Right Now I don't have VS2013 anymore.... but maybe the corrupt File stills there...

    I have to Re-Install VS2015 but i'm working with it, so I can't for now...

    Friday, August 21, 2015 8:47 PM
  • Update: Didn't works :C
    Saturday, August 22, 2015 3:18 AM
  • Are you targeting x86?

    http://pauliom.wordpress.com

    Saturday, August 22, 2015 6:07 AM
  • 

    |Debug/Release| |ARM/x64/x86| |Local Machine/Simulator/Emulator| Panel? (I Can't post images)

    Do you mean this?... I Tried with ARM, x64, x86, Debug and Release but no one works

    Sunday, August 23, 2015 3:18 PM
  • Yes, try setting it to x86, save the project and close VS. Make sure you don't have any XDesProc.exe running in the details of Task Manager. Then re-open and see if that is any better.

    http://pauliom.wordpress.com

    Sunday, August 23, 2015 3:37 PM
  • I discovered this morning that my 11 inch laptop was still running the release candidate of VS 2015 community and the problem was already there in that release.
    Sunday, August 23, 2015 5:49 PM
  • It was already in x86 :/
    Sunday, August 23, 2015 8:21 PM
  • do you know what this variable means? Solution works for me, but I'm afraid that it would break something else

    And how you found it?


    notacat


    • Edited by notacat Monday, August 24, 2015 6:46 PM
    Monday, August 24, 2015 6:46 PM
  • "System.NullReferenceException
    Object reference not set to an instance of an object."

    that variable? I don't have any .... idea.

    Monday, August 24, 2015 9:25 PM
  • Are you still experiencing the System.NullReferenceException when opening the XAML page in the XAML designer?

    If so, is this a C++ UWP which you have created and are still facing this problem? Or is this problem happening with a C# UWP?


    Windows Store Developer Solutions, follow us on Twitter: @WSDevSol|| Want more solutions? See our blog

    Wednesday, August 26, 2015 12:40 AM
  • My problem is a C# UWP.  I don't have a problem on my Desktop Windows Home edition.  But my Surface 3 pro and my other laptop are running Windows Pro edition and will not display the MainPage.
    • Edited by MDC3161 Wednesday, August 26, 2015 3:38 PM
    Wednesday, August 26, 2015 2:08 AM
  • Fixed!!

    To fix the problem open your solution.  

    1. Right click the solution and select "Manage Nuget Packages..."

    2. In the Nuget Package Msnager search for "Microsoft.NETcore.UniversalWindowsPlatform"

    3. Click on the "Install" button.  Reload the designer.

    • Marked as answer by MDC3161 Wednesday, August 26, 2015 6:39 PM
    Wednesday, August 26, 2015 6:39 PM
  • Great, glad to know that you have a solution.

    Windows Store Developer Solutions, follow us on Twitter: @WSDevSol|| Want more solutions? See our blog

    Wednesday, August 26, 2015 7:14 PM
  •  DIdn't works for me :( I had installed the same package before, tried re-installing it but didn't works either.

    I'll open another thread because maybe this is not the same error D:
    Wednesday, August 26, 2015 8:47 PM
  • Yes, please open a new thread.

    Windows Store Developer Solutions, follow us on Twitter: @WSDevSol|| Want more solutions? See our blog

    Wednesday, August 26, 2015 9:32 PM
  • I have the same prob on my community edition copy too, and I have the nuget already installed. This is frankly embarrassing.


    http://pauliom.wordpress.com

    Wednesday, August 26, 2015 9:37 PM
  • I have the same prob on my community edition copy too, and I have the nuget already installed. This is frankly embarrassing.


    http://pauliom.wordpress.com


    Do you have the same callstack, same project type and same symptoms - opening the MainPage.xaml file from a C# UWP inside the XAML designer is returning a System.NullReferenceException with the above callstack?

    Windows Store Developer Solutions, follow us on Twitter: @WSDevSol|| Want more solutions? See our blog

    Wednesday, August 26, 2015 10:25 PM
  • Start->Blend->New Project->Universal App == same stack


    http://pauliom.wordpress.com

    Thursday, August 27, 2015 6:59 AM
  • Start->Blend->New Project->Universal App == same stack


    http://pauliom.wordpress.com


    I understand that it is a new project, but new project in which programming "LANGUAGE"? C# or C++? There is a known issue for C++ UWP apps which is documented here: 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

    If the development language is C# (and hence not C++), can you tell me if you have an environment variable called "MCD"? To check for Environment variables, Start -> Edit the System Environment variables -> Environment Variables -> System Variables -> Check for variable named MCD 


    Windows Store Developer Solutions, follow us on Twitter: @WSDevSol|| Want more solutions? See our blog

    Thursday, August 27, 2015 5:14 PM
  • sorry, c#

    http://pauliom.wordpress.com

    Thursday, August 27, 2015 6:11 PM
  • OK, thanks for clarifying. Now can you check if you have that environment variable I mentioned in my previous response? If it exists, delete that environment variable and retry (the name of the environment variable is: "MCD").

    Windows Store Developer Solutions, follow us on Twitter: @WSDevSol|| Want more solutions? See our blog

    Thursday, August 27, 2015 7:12 PM
  • On my desktop running windows 10 home edition I had "Platform HPD".  I removed that line and it fixed that problem.  On my two computer's running windows 10 pro,  that line didn't exist.
    Thursday, August 27, 2015 7:19 PM
  • I did have MCD and removing it seems to have resolved the issue :)

    http://pauliom.wordpress.com

    Thursday, August 27, 2015 9:30 PM
  • I did have MCD and removing it seems to have resolved the issue :)

    http://pauliom.wordpress.com

    Great, I am glad to hear that. That Environment variable does not get set by Windows or VS installation and is probably getting set through some other software, but we have a bug which is tracking a permanent fix for the environment variable problem (not having such a dependency).

    Hopefully all the System.NullReferenceException problems for the XAML designer reported by everyone on this thread are resolved. If not, please let me know.


    Windows Store Developer Solutions, follow us on Twitter: @WSDevSol|| Want more solutions? See our blog

    Thursday, August 27, 2015 9:59 PM
  • Phew! I have a clean install of Windows 10 and Visual Studio 15, and had the same problem.  Removing that environment variable did the trick.  Thank you!
    Saturday, September 12, 2015 11:51 PM