locked
NullReferenceException in Designer RRS feed

  • Question

  • Hey,

    Seems like I can not run the designer on UW apps, thing is that it works on every other place, for example Winforms, wpf and so on.

    Haven't found any solution, turning here for some help!

    Thanks!

    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)



    Wednesday, September 16, 2015 8:32 AM

Answers

  • Hello Vincent Gio,

    >>Seems like I can not run the designer on UW apps, thing is that it works on every other place, for example Winforms, wpf and so on.

    Will your project is a C++ project? If so, this is already an known issue, you could check this thread for the caused reason and there is also a workaround:

    RTM Known Issue: Opening a XAML page from a C++ UWP in Visual Studio 2015 may cause the XAML Designer to throw a System.NullReferenceException exception

    If it is a C# project, then please follow below steps(provided by Prashant in this thread):

    1.Check if there is an environment variable called "MCD", Start -> Edit the System Environment variables -> Environment Variables -> System Variables -> Check for variable named MCD

    2.If it exists, delete that environment variable and retry (the name of the environment variable is: "MCD").

    By the way, please also check this guide post to add a proper tag for the thread title.

    Regards.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    • Marked as answer by Vincent Gio Thursday, September 17, 2015 12:00 PM
    Thursday, September 17, 2015 9:16 AM

All replies

  • Hello Vincent Gio,

    >>Seems like I can not run the designer on UW apps, thing is that it works on every other place, for example Winforms, wpf and so on.

    Will your project is a C++ project? If so, this is already an known issue, you could check this thread for the caused reason and there is also a workaround:

    RTM Known Issue: Opening a XAML page from a C++ UWP in Visual Studio 2015 may cause the XAML Designer to throw a System.NullReferenceException exception

    If it is a C# project, then please follow below steps(provided by Prashant in this thread):

    1.Check if there is an environment variable called "MCD", Start -> Edit the System Environment variables -> Environment Variables -> System Variables -> Check for variable named MCD

    2.If it exists, delete that environment variable and retry (the name of the environment variable is: "MCD").

    By the way, please also check this guide post to add a proper tag for the thread title.

    Regards.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    • Marked as answer by Vincent Gio Thursday, September 17, 2015 12:00 PM
    Thursday, September 17, 2015 9:16 AM
  • Thank you for these,

    I went on and followed a suggestion to install "Microsoft.NETcore.UniversalWindowsPlatform" from NuGet. It turned out I had this, so I uninstalled and installed!

    Thursday, September 17, 2015 12:00 PM