WPF designer error when selecting new WPF project

0

I'm getting the following error when I select a new WPF project.

Loading this assembly would produce a different grant set from other instances. (Exception from HRESULT: 0x80131401)
   at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandle& ctor, Boolean& bNeedSecurityCheck)
   at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean fillCache)
   at System.RuntimeType.CreateInstanceImpl(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean fillCache)
   at System.Activator.CreateInstance(Type type, Boolean nonPublic)
   at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
   at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
   at System.Activator.CreateInstance(String assemblyName, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityInfo, StackCrawlMark& stackMark)
   at System.Activator.CreateInstance(String assemblyName, String typeName)
   at System.AppDomain.CreateInstance(String assemblyName, String typeName)
   at System.AppDomain.CreateInstanceAndUnwrap(String assemblyName, String typeName)
   at System.AppDomain.CreateInstanceAndUnwrap(String assemblyName, String typeName)
   at MS.Internal.Package.VSIsolationProviderService.CreateIsolationProvider(String identity, AssemblyReferenceProvider assemblyReferences, IEnumerable`1 assemblyFolders)
   at MS.Internal.Providers.VSDesignerContext.GetIsolationProvider(IServiceProvider provider, IVsHierarchy hierarchy, AssemblyReferenceProvider assemblyReferences)
   at MS.Internal.Providers.VSDesignerContext.Initialize(IServiceProvider provider, IVsHierarchy hierarchy, UInt32 itemid, Object docDataObj)
   at MS.Internal.Providers.VSDesignerContext..ctor(IServiceProvider provider, IVsWindowFrame frame, Object docDataObj)
   at MS.Internal.Providers.VSDesignerContext.GetContext(IServiceProvider services, IVsWindowFrame frame, Boolean createIfNotExist)
   at MS.Internal.Designer.DesignerPane.InitializeDesigner()
c#
wpf
asked on Stack Overflow Jul 12, 2010 by user306616 • edited Sep 5, 2012 by skeletank

1 Answer

0

(from http://www.designasp.net/blog/en/post/2009/03/29/XAML-designer-Loading-this-assembly-would-produce-a-different-grant-set-from-other-instances-%28Exception-from-HRESULT-0x80131401%29.aspx)

If you get this error when opening the WPF editor, try:

  1. Open a second instance of Visual Studio and try to open XAML.
  2. Close all .xaml and .xml files, close Visual Studio, re-open it and open .xaml file.
  3. Disable all add-ins in Tools -> Add-in manager
  4. "Reset all settings" in Visual Studio.
  5. Install CLR patch (KB963676) that should help with fixing of XAML designer. There is a known feedback from Microsoft which states that this should help. Download here (https://connect.microsoft.com/VisualStudio/Downloads/DownloadDetails.aspx?DownloadID=16827&wa=wsignin1.0). The *.msu are patches for Windows Vista or Windows Server 2008. The *.exe for Windows XP or Windows Server 2003. Even if you are using 64-bit machines, you still need x86 patch since Visual Studio 2008 is a 32-bit application.
  6. Uninstall all Silverlight tools, runtime, SDKs, Expression Blend. After this, repair Visual Studio.
  7. Reinstall Visual Studio and .NET Framework.

If none works, you will have to reinstall the OS.

answered on Stack Overflow Jul 12, 2010 by simonalexander2005 • edited Jul 12, 2010 by simonalexander2005

User contributions licensed under CC BY-SA 3.0