WPF designer error when selecting new WPF project
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.CreateIns开发者_Go百科tance(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()
(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:
- Open a second instance of Visual Studio and try to open XAML.
- Close all .xaml and .xml files, close Visual Studio, re-open it and open .xaml file.
- Disable all add-ins in Tools -> Add-in manager
- "Reset all settings" in Visual Studio.
- 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.
- Uninstall all Silverlight tools, runtime, SDKs, Expression Blend. After this, repair Visual Studio.
- Reinstall Visual Studio and .NET Framework.
If none works, you will have to reinstall the OS.
精彩评论