locked
Unhandled Exception in XAML Designer for WinRT application (Visual Studio 2012 Update 3)

    Question

  • I receive this error in ALL of my xaml designers for my project.

    System.ArgumentNullException

    Value cannot be null.Parameter name: key

       at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)   at Microsoft.Expression.DesignModel.Metadata.PlatformMetadataBase.NewReplacedExternalType(PlatformMetadataBase platformMetadata, IPlatformTypes sourcePlatformTypes, IAssembly assembly, Type keyType, Type replaceType, ITypeId baseType, ITypeId neutralType, IXmlNamespace xmlNamespace, String clrNamespace, AttributeCollection attributes, ProxyPropertyDescription[] properties)   at Microsoft.Expression.DesignModel.Metadata.PlatformMetadataBase.NewReplacedExternalType(PlatformMetadataBase platformMetadata, IPlatformTypes sourcePlatformTypes, IAssembly assembly, Type keyType, Type replaceType, ITypeId baseType, ITypeId neutralType, IXmlNamespace xmlNamespace, String clrNamespace, ProxyPropertyDescription[] properties)   at Microsoft.Expression.WindowsXamlPlatform.WindowsUIXamlPlatformMetadata.OnInitialize()   at Microsoft.Expression.WindowsXamlPlatform.WindowsUIXamlPlatform.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.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()

    System.ArgumentNullException

    Value cannot be null.Parameter name: key

    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.ArgumentNullException

    Value cannot be null.Parameter name: key

       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)

    I have opened old versions of the project and even different projects and I still get the same thing. The only time I can get the designer to work is in a new project. However, If I add a reference (like DevExpress) the designer breaks in the new project. I have tried repairing the Visual Studio 2012 and even tried uninstalling and reinstalling the updates and it doesn't make a difference.

    Another thing to note is that when I get this error intellisense, auto formatting, and the preference window all stops working in the xaml file but work in the cs files.

    Final note. The project still compiles and works just fine!

    Friday, July 19, 2013 9:48 PM

Answers

  • I believe this is a known issue. Please check if your if your program files folder (Program Files -> Properties -> Security Tab) has these permissions set for "ALL APPLICATION PACKAGES" >> Read, Read & Execute , List Folder contents. We have seen that these permissions get removed sometimes on users computers. If not please add these to the folder and your problem should be solved. You can use the below command to do the same

    icacls "C:\Program Files (86)" *S-1-15-2-1:(CI)(F) (Run as administrator)


    Dev@Mic

    Saturday, July 20, 2013 8:05 PM

All replies

  • Same problem here...
    Saturday, July 20, 2013 1:06 AM
  • I believe this is a known issue. Please check if your if your program files folder (Program Files -> Properties -> Security Tab) has these permissions set for "ALL APPLICATION PACKAGES" >> Read, Read & Execute , List Folder contents. We have seen that these permissions get removed sometimes on users computers. If not please add these to the folder and your problem should be solved. You can use the below command to do the same

    icacls "C:\Program Files (86)" *S-1-15-2-1:(CI)(F) (Run as administrator)


    Dev@Mic

    Saturday, July 20, 2013 8:05 PM
  • Alright thanks. What happened is the "ALL APPLICATION PACKAGES" Group was actually missing from the "Program Files (x86)" Security. All I had to do was go in Click add, Change the location to the current desktop (not domain local) and click advanced. In the advanced window click find all and look for "ALL APPLICATION PACKAGES" and add it into the permissions. Once you click okay you will need to wait for it to finish and possibly skip a couple files. However, when it was done my problem was fixed!

    Thanks!

    Monday, July 22, 2013 2:22 PM
  • Thank you!  I have been battling this for over a week and it was driving me crazy.  Adding the All Application Packages to Program Files (x86) fixed it for me!
    Monday, July 29, 2013 4:19 PM
  • I have this same problem and this solution doesn't work. It seems this only stops working when I add a reference to the C++ runtime to my project. I change the active solution platform to x86 and it still fails to work. I've removed visual studios several times and reinstalled with no luck.

    http://rbrundritt.wordpress.com

    Friday, August 9, 2013 4:47 PM