locked
Designer fails loading Windows Store XAML apps in Visual Studio 2012 and Blend

    Question

  • I'm using Windows 8 Pro x64 and Visual Studio 2012 Ultimate. Since a few days (maybe weeks), both Visual Studio 2012 and Blend fails loading any Windows Store XAML apps.

    I'm not sure when the problem started exactly because I've been doing a lot of HTML/JavaScript Windows Store apps in the past few weeks and less XAML/C#.

    This is not an issue related to my code. It always fail, even with a fresh project based on one of the VS templates : Blank App, Grid App, etc... BUT, I can compile and run the app without any problem ! The error is only at design time.

    Symptoms :

    In Visual Studio, I don't get any error. The UI of my app in the designer is just completely gray. I can see there is elements if I move my mouse over the designer, but nothing shows up, as you can see in the following screenshot :

    In Blend, it's even worse : I can't open any of the xaml page. I keep getting the same error :

    System.InvalidCastException
    Unable to cast object of type 'MS.Internal.NamedObject' to type 'System.Windows.Media.Brush'.
       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.InvalidCastException
    Unable to cast object of type 'MS.Internal.NamedObject' to type 'System.Windows.Media.Brush'.
    
    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.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.InvalidCastException
    Unable to cast object of type 'MS.Internal.NamedObject' to type 'System.Windows.Media.Brush'.
       at Microsoft.Expression.DesignSurface.UserInterface.ArtboardBorder..ctor(ViewExceptionCallback viewExceptionCallback)
       at Microsoft.Expression.DesignSurface.UserInterface.Artboard..ctor(IViewObjectFactory viewObjectFactory, ViewExceptionCallback viewExceptionCallback)
       at Microsoft.Expression.DesignSurface.UserInterface.DeviceViewArtboard..ctor(IViewObjectFactory viewObjectFactory, ViewExceptionCallback viewExceptionCallback)
       at Microsoft.Expression.DesignSurface.UserInterface.WindowsUIXamlArtboard..ctor(ISurface platformView, IViewObjectFactory viewObjectFactory, ViewExceptionCallback viewExceptionCallback, XamlImageHost windowsUIXamlImageHost)
       at Microsoft.Expression.DesignSurface.View.WindowsUIXamlSceneView.CreateArtboard()
       at Microsoft.Expression.DesignSurface.View.SceneView.EnsureArtboard()
       at Microsoft.Expression.DesignSurface.View.WindowsUIXamlSceneView.SetVisible(Boolean visible)
       at Microsoft.Expression.DesignSurface.DocumentViewContext.CreateAndOpenView(ISourceItemContext sourceItem, CancellationToken cancelToken, Boolean activate, Boolean ensureOpenInHost, Boolean suppressUI)
       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()

    Here is a screenshot of Blend :


    What have I tried :

    I've tried to :

    This error seems to be the same as mine but it's still unresolved : http://social.msdn.microsoft.com/Forums/en-US/toolsforwinapps/thread/a11c96bb-5f43-4c5f-842f-a9ab1dcdd702

    Extra information : 

    I have also installed the Windows Phone 8 SDK, and the ASP.NET and Web Tools 2012.2 update. Not sure if it could be related.

    My question :)

    So, did anybody else already have the same issue and is there any way to fix it ? Is making a fresh install of Windows 8 my last hope ? I would like to know at least what went wrong, because I don't want to start all over again in two weeks after I've re-installed all the tools... 

    Thanks for reading ! 
    Best regards,
    Renaud


    ---------------------------------------------------------

    UPDATE / More info : 

    If I add a new user and that I run Visual Studio, it works fine !

    I've tried to run some commands like devenv /ResetSkipPkgs and devenv /ResetSettings without success.


    http://www.renauddumont.be




    Tuesday, February 26, 2013 10:34 PM

Answers

  • I don't think this is a "solution", but at least it saved me from reinstalling Windows.

    I deleted my User profile on Windows and recreated it. Now Visual Studio and Blend are loading my XAML pages again.

    I'll mark this as the answer unless anybody has a better answer on how to fix this issue without deleting the User profile.


    http://www.renauddumont.be


    Wednesday, February 27, 2013 8:12 AM