none
XAML Designer Crashing with System.NullReferenceException

    Question

  • Now I've seen a few threads on this issue and I can't see to find a single answer to my problem. I've been trying to battle with the VS2015 Designer for the last three days and now it's starting to cost a bit too much.

    Basically when trying to use it I get the error System.NullReferenceException (Object reference not set to an instance of an object.) this also happens in blend. This is when trying to work with a C# Universal Windows Platform app. I've tried creating a C++ App, repairing VS2015, re-installing VS2015, I've not got HP but I went looking for the platform variable in my Environment Variables and it wasn't there, I've tried creating multiple C# Apps and every time the designer refuses to start.

    I had to do a System Restore on my PC to a time before I had VS2015 and this has happened since having it re-installed, I've tried clearing all of the VS2015 files and still no luck. The details of the Unhandled Exception I get when trying to open the designer are as follows:

    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__DisplayClass29_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)

    I'm really out of options now, I'm not quite sure what else I can do. As I say I've looked at most of the threads on Google now.

    Saturday, August 13, 2016 6:58 PM

Answers

  • Hi RicardoJarree,

    Thanks for your post.

    Could you please tell me what's the version of your Visual Studio 2015 and Windows System?

    >>I've tried creating multiple C# Apps and every time the designer refuses to start.

    Does the error occurred only for C# UWP project? How about creating C# windows form or WPF app? Does it have the same issue?

    First try to change the target version to Windwos 10 (10.0, Build 10240) in Project Properties.

    Please restart your machine and disable the anti-virus software and firewall and run your Visual Studio as administrator then try it again.

    Also running your Visual Studio in Safe mode to Check whether some add-ins and extensions affect it (devenv /safemode)

    If above suggestions still no help. Try to install the VS2015 Update3. The latest update of  your Visual Studio 2015.

    Best Regards,

    Lake Xiao

    Monday, August 15, 2016 3:10 AM
    Moderator