locked
Visual Studio 2012 WPF Designer System.NullReferenceException RRS feed

  • Question

  • Visual Studio 2012 WPF Designer does not give me a view of my form.  All I ever get back is System.NullReferenceException.  I saw under some other discussions that there is a bug when WPF inherits from Projects that have a lower Framework reference but I'm not sure if this is the same deal.  I don't use Expression but its all over the message.  At times, I have no Intellisense in the designer either.  Anyone know how to get around this? 

    The full error:

    System.NullReferenceException
    Object reference not set to an instance of an object.
       at Microsoft.Expression.DesignHost.Isolation.Remoting.STAMarshaler.WaitForCompletion(NestedCallContext nestedCallContext, BlockingCall call, WaitHandle timeoutSignal)
       at Microsoft.Expression.DesignHost.Isolation.Remoting.STAMarshaler.MarshalOutSynchronous(Action action, Int32 targetApartmentId, WaitHandle aborted, WaitHandle timeoutSignal)
       at Microsoft.Expression.DesignHost.Isolation.Remoting.STAMarshaler.MarshalOut(Action action, Int32 targetApartmentId, WaitHandle aborted, CallSynchronizationMode syncMode, WaitHandle timeoutSignal)
       at Microsoft.Expression.DesignHost.Isolation.Remoting.ThreadMarshaler.MarshalOut[TValue](RemoteHandle`1 targetObject, Action action, CallSynchronizationMode syncMode)
       at Microsoft.Expression.DesignHost.Isolation.Remoting.ThreadMarshaler.MarshalOut[TResult,TValue](RemoteHandle`1 targetObject, Func`2 func, CallSynchronizationMode syncMode)
       at Microsoft.Expression.DesignHost.Isolation.Remoting.LocalDesignerService.CreateDesignerImpl(IHostSourceItem item, IHostTextEditor editor, RemoteCancellationToken remoteCancelToken)
       at Microsoft.Expression.DesignHost.Isolation.Remoting.LocalDesignerService.<>c__DisplayClass12.<Microsoft.Expression.DesignHost.IDesignerService.CreateDesigner>b__11(RemoteCancellationToken remoteToken)
       at Microsoft.Expression.DesignHost.Isolation.Remoting.LocalDesignerService.CallWithCancellation[TResult](CancellationToken cancelToken, Func`2 func)
       at Microsoft.Expression.DesignHost.Isolation.Remoting.LocalDesignerService.Microsoft.Expression.DesignHost.IDesignerService.CreateDesigner(IHostSourceItem item, IHostTextEditor editor, CancellationToken cancelToken)
       at Microsoft.Expression.DesignHost.IsolatedDesignerService.IsolatedDesignerView.CreateDesignerViewInfo(CancellationToken cancelToken)

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

    Server stack trace:
       at Microsoft.Expression.DesignHost.Isolation.Remoting.STAMarshaler.WaitForCompletion(NestedCallContext nestedCallContext, BlockingCall call, WaitHandle timeoutSignal)
       at Microsoft.Expression.DesignHost.Isolation.Remoting.STAMarshaler.MarshalIn(Action action, Int32 targetApartmentId)
       at Microsoft.Expression.DesignHost.Isolation.Remoting.ThreadMarshaler.MarshalIn(IRemoteObject targetObject, Action action)
       at Microsoft.Expression.DesignHost.Isolation.Remoting.ThreadMarshaler.MarshalIn[TResult](IRemoteObject targetObject, Func`1 func)
       at Microsoft.Expression.DesignHost.Isolation.Remoting.RemoteDesignerService.Microsoft.Expression.DesignHost.Isolation.Remoting.IRemoteDesignerService.CreateDesigner(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.PrivateProcessMessage(RuntimeMethodHandle 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.Expression.DesignHost.Isolation.Remoting.IRemoteDesignerService.CreateDesigner(IRemoteHostSourceItem remoteItem, IRemoteHostTextEditor remoteEditor, IRemoteCancellationToken cancelToken)
       at Microsoft.Expression.DesignHost.Isolation.Remoting.LocalDesignerService.<>c__DisplayClass8.<CreateDesignerImpl>b__6(IRemoteDesignerService d)
       at Microsoft.Expression.DesignHost.Isolation.Remoting.ThreadMarshaler.<>c__DisplayClass4`2.<MarshalOut>b__3()
       at Microsoft.Expression.DesignHost.Isolation.Remoting.STAMarshaler.Call.InvokeWorker()

    System.NullReferenceException
    Object reference not set to an instance of an object.
       at Microsoft.Expression.DesignModel.Metadata.MetadataStore.GetTypeConverter(Type type)
       at Microsoft.Expression.WpfPlatform.WpfDesignTimeProperties.RegisterProperty(IPropertyId neutralPropertyKey, IType declaringType, FrameworkPropertyMetadataOptions options, PropertyChangedCallback callback)
       at Microsoft.Expression.WpfPlatform.WpfDesignTimeProperties.RegisterProperty(IPropertyId neutralPropertyKey, Type declaringType, FrameworkPropertyMetadataOptions options, PropertyChangedCallback callback)
       at Microsoft.Expression.WpfPlatform.WpfDesignTimeProperties.RegisterProperty(IPropertyId neutralPropertyKey, Type declaringType, PropertyChangedCallback callback)
       at Microsoft.Expression.WpfPlatform.WpfDesignTimeProperties.RegisterProperty(IPropertyId neutralPropertyKey, Type declaringType)
       at Microsoft.Expression.WpfPlatform.WpfCommonDesignTimeProperties.Initialize(WpfDesignTimeProperties designTimeProperties)
       at Microsoft.Expression.WpfPlatform.WpfDesignTimeProperties..ctor(PlatformMetadataBase platformMetadata)
       at Microsoft.Expression.WpfPlatform.WpfPlatformMetadata.OnInitialize()
       at Microsoft.Expression.DesignModel.Metadata.PlatformMetadataBase.Initialize()
       at Microsoft.Expression.WpfPlatform.WpfPlatform.Initialize()
       at Microsoft.Expression.Platform.PlatformCreatorBase.CreatePlatform(IPlatformReferenceAssemblyResolver referenceAssemblyResolver)
       at Microsoft.Expression.DesignSurface.Project.ProjectContextBase.Initialize()
       at Microsoft.Expression.DesignSurface.Project.XamlProjectContext.Initialize()
       at Microsoft.Expression.DesignSurface.Project.ProjectContextManager.GetProjectContext(IHostProject project, IPlatform platform, Boolean create)
       at Microsoft.Expression.DesignSurface.Project.ProjectContextManager.<GetReferencedProjects>d__d.MoveNext()
       at Microsoft.Expression.DesignSurface.Project.ProjectContextBase.XamlProjectMetadata.GetAssemblyForTypeResolve(String assemblyName)
       at Microsoft.Expression.DesignModel.Metadata.TypeResolver.GetType(ClrNamespaceIdentifier clrNamespaceIdentifier, String typeName)
       at Microsoft.Expression.DesignModel.Metadata.TypeResolver.ResolveType(ITypeId typeId)
       at Microsoft.Expression.DesignModel.Metadata.ProjectNeutralTypesAttributeTable.ResolveType(ITypeResolver typeResolver, ITypeId typeId)
       at Microsoft.Expression.DesignModel.Metadata.ProjectNeutralTypesAttributeTable.RegisterDataGridAttributeTable(ITypeResolver typeResolver)
       at Microsoft.Expression.WpfPlatform.WpfPlatform.RefreshProjectSpecificMetadata(ITypeResolver typeResolver, ITypeMetadataFactory typeMetadataFactory)
       at Microsoft.Expression.DesignSurface.Project.ProjectContextBase.Initialize()
       at Microsoft.Expression.DesignSurface.Project.XamlProjectContext.Initialize()
       at Microsoft.Expression.DesignSurface.Project.ProjectContextManager.GetProjectContext(IHostProject project, IPlatform platform, Boolean create)
       at Microsoft.Expression.DesignSurface.Project.ProjectContextManager.GetSourceItemContext(IHostSourceItem sourceItem)
       at Microsoft.Expression.DesignSurface.DesignerService.CreateDesigner(IHostSourceItem item, IHostTextEditor editor, CancellationToken cancelToken)
       at Microsoft.Expression.DesignHost.Isolation.Remoting.RemoteDesignerService.<>c__DisplayClass10.<>c__DisplayClass12.<Microsoft.Expression.DesignHost.Isolation.Remoting.IRemoteDesignerService.CreateDesigner>b__f(CancellationToken cancelToken)
       at Microsoft.Expression.DesignHost.Isolation.Remoting.RemoteDesignerService.CallWithCancellation[TResult](IRemoteCancellationToken remoteToken, Func`2 func)
       at Microsoft.Expression.DesignHost.Isolation.Remoting.RemoteDesignerService.<>c__DisplayClass10.<Microsoft.Expression.DesignHost.Isolation.Remoting.IRemoteDesignerService.CreateDesigner>b__e()
       at Microsoft.Expression.DesignHost.Isolation.Remoting.ThreadMarshaler.<>c__DisplayClass16`1.<MarshalIn>b__15()
       at Microsoft.Expression.DesignHost.Isolation.Remoting.STAMarshaler.Call.InvokeWorker()


    Data Integration Application Developer

    Friday, October 19, 2012 6:04 PM

All replies

  • Check your project references. I had this same problem when one of my other projects that I referenced was compiled to .NET 2.0. I re-compiled it to .NET 4.0 and now my designer works.

    Chad

    Thursday, October 25, 2012 6:43 PM
  • So, does everything in the project need to be on the same framework?  I have base libraries (non WPF projects) that are framework 2.0.

    Data Integration Application Developer

    Monday, November 5, 2012 9:46 PM
  • Well... I went through and took all WPF projects and moved them to Framework 4.5... I still got the error.  I then went through and updated all my base projects and set them to Framework 4.5... and I still get the error.  Nothing makes this designer happy.

    Any other ideas? Anyone?


    Data Integration Application Developer

    Tuesday, November 6, 2012 3:10 AM
  • I uninstalled VS 2010 and performed a repair on VS 2012.  It now works.

    Data Integration Application Developer

    • Marked as answer by Joel Palmer Tuesday, November 6, 2012 9:07 PM
    • Unmarked as answer by Joel Palmer Wednesday, November 7, 2012 8:15 PM
    Tuesday, November 6, 2012 9:07 PM
  • I withdraw my submission.  This lasted all of 5 minutes and I am back to my same issues.

    Data Integration Application Developer

    Wednesday, November 7, 2012 8:15 PM
  • Still no solution to this? I have a similar exception in Visual Studio designer. My wpf form shows in a fraction of a second, and then I get this kind of exception window. Hopeless to work with Visual Studio when this happens.

    Kjaps


    • Edited by Kjaps Wednesday, December 5, 2012 12:59 PM
    Wednesday, December 5, 2012 12:44 PM
  • You may want to see if VS Update 1 helps:

    http://www.microsoft.com/visualstudio/eng/visual-studio-update


    Marco Goertz / Sr. Development Lead / XAML UI Designer / Client Platform Tools / Microsoft

    Wednesday, December 19, 2012 5:24 PM