WPF设计器 - 拒绝访问0x80070005 [英] WPF designer - Access is denied 0x80070005

查看:64
本文介绍了WPF设计器 - 拒绝访问0x80070005的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


在新笔记本电脑上新安装Visual Studio 2017 - 版本15.9.9时遇到问题。


安装没有任何问题。我正在处理的已加载项目没有问题。


但是WPF设计器显示下一个错误

 System.UnauthorizedAccessException 
访问被拒绝。 (来自HRESULT的异常:0x80070005(E_ACCESSDENIED))
at System.Reflection.RuntimeAssembly.nLoadFile(String path,Evidence evidence)
at System.Reflection.Assembly.LoadFile(String path)
at Microsoft.VisualStudio.DesignTools.Utility.AssemblyHelper.LoadFile(String path,Action`1 logger)
at Microsoft.VisualStudio.DesignTools.Designer.Metadata.Assemblies.AssemblyService.CreateClassicShadowCopy(String assemblyPath,String projectPath,ReferenceAssemblyContext context, Boolean useReflectionOnlyLoad)
at Microsoft.VisualStudio.DesignTools.Designer.Metadata.Assemblies.AssemblyService.ResolveShadowCopyAssembly(String assemblyPath,String projectPath,ReferenceAssemblyContext context,Boolean useReflectionOnlyLoad)
at Microsoft.VisualStudio.DesignTools.Designer.Metadata .Assemblies.AssemblyService.ResolveAssembly(String assemblyPath,String assemblyFullName,String projectPath,ReferenceAssemblyContext context,Boolean useReflectionOnlyLoad)
a牛逼Microsoft.VisualStudio.DesignTools.Designer.Metadata.Assemblies.ProjectAssemblyResolver.GetAssemblyInformationInternal(字符串路径)
。在微软Microsoft.VisualStudio.DesignTools.Designer.Metadata.Assemblies.ProjectAssemblyResolver.GetAssemblyInformation(字符串assemblyLocation)
.VisualStudio.DesignTools.Designer.Metadata.Assemblies.ProjectAssemblyResolver.InternalAddAssemblyReference(String assemblyLocation)
at Microsoft.VisualStudio.DesignTools.Designer.Metadata.Assemblies.ProjectAssemblyResolver.UpdateAssemblyReferences(IEnumerable`1 referencesToUpdate)
at Microsoft .VisualStudio.DesignTools.Designer.Metadata.Assemblies.ProjectAssemblyResolver.Initialize()
在Microsoft.VisualStudio.DesignTools.Designer.Metadata.Assemblies.ProjectAssemblyService.GetProjectAssemblyResolver(IHostProject项目)在Microsoft.VisualStudio.DesignTools
.Designer.Metadata.Assemblies.ProjectAssemblyService.CreatePlatformReferenceAssemblyResolver(IHostProjec科技项目)
在Microsoft.VisualStudio.DesignTools.Designer.Documents.Project.ProjectContextManager.CreatePlatformReferenceAssemblyResolver(IHostProject项目)
在Microsoft.VisualStudio.DesignTools.Designer.Documents.Project.ProjectContextManager.GetProjectContext(IHostProject项目,IPlatform平台,布尔创建)
at Microsoft.VisualStudio.DesignTools.Designer.Documents.Project.ProjectContextManager。< GetContextsInActiveSolution> d__94.MoveNext()
at Microsoft.VisualStudio.DesignTools.XamlDesigner.Commands。 ReplaceStyleTemplateCommand.ResolveDefaultStyle(SceneNode targetElement,Object defaultStyleKey,Boolean allowDefaultStyle,DocumentNode& currentStyle,Boolean& isThemeStyle,IList`1& auxiliaryResources)
at Microsoft.VisualStudio.DesignTools.XamlDesigner.Commands.ReplaceStyleTemplateCommand.ProvideCurrentStyle(SceneNode targetElement,IType targetType,PropertyReference targetPropertyReference,Boolean allowDefaultStyle,IList`1& auxiliaryResources)
at Microsoft.VisualStudio.DesignTools。 XamlDesigner.Commands.EditCopyOfStyleCommand.get_IsEnabled()
at Microsoft.VisualStudio.DesignTools.Utility.Commands.Command.GetProperty(String propertyName,Object defaultValue)
at Microsoft.VisualStudio.DesignTools.XamlDesigner.Commands.ReplaceStyleTemplateCommand .GetProperty(String propertyName)
at Microsoft.VisualStudio.DesignTools.Utility.Commands.CommandTarget。<> c__DisplayClass21_0。< GetCommandProperty> b__0()
at Microsoft.VisualStudio.DesignTools.Utility.ProtectionZone .DummyProtectionZone.Execute [T](Func`1 func)
at Microsoft.VisualStudio.DesignTools.Utility.Commands.CommandTarget.GetCommandProperty(String com mandName,String propertyName)
at Microsoft.VisualStudio.DesignTools.Designer.Views.SceneView.UpdateCommandState(IEnumerable`1 commandNames,Boolean forceRefresh)
at Microsoft.VisualStudio.DesignTools.Designer.Views.SceneView.SelectionManager_LateActiveSceneUpdatePhase (对象发件人,SceneUpdatePhaseEventArgs参数)
。在Microsoft.VisualStudio.DesignTools.Designer.ViewModel.SceneUpdatePhaseEventHandler.Invoke(对象发件人,SceneUpdatePhaseEventArgs E)
。在Microsoft.VisualStudio.DesignTools.Designer.ViewModel.Selection.SelectionManager .FireLateActiveSceneUpdatePhase(SceneUpdatePhaseEventArgs参数)
在Microsoft.VisualStudio.DesignTools.Designer.Views.SceneViewUpdateScheduleTask.UpdateLate()
在Microsoft.VisualStudio.DesignTools.Utility.Scheduler.ScheduleTask.Update()
at Microsoft.VisualStudio.DesignTools.Utility.Scheduler.SchedulingService.DispatchTasksAtPriority(DispatcherPriority priority)
at Microsoft.VisualStudio.DesignTool s.Utility.Scheduler.SchedulingService.DispatcherToken.Dispatch(Object arg)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback,Object args,Int32 numArgs)
at System.Windows.Threading。 ExceptionWrapper.TryCatchWhen(Object source,Delegate callback,Object args,Int32 numArgs,Delegate catchHandler)
at System.Windows.Threading.DispatcherOperation.InvokeImpl()
at System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(对象状态)
在System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext,ContextCallback callback,Object state,Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext,ContextCallback callback,Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext,ContextCallback callback,Object state)
at MS.Internal.CulturePreservingExecutionContext.Run(Cul turePreservingExecutionContext executionContext,ContextCallback callback,Object state)
at System.Windows.Threading.DispatcherOperation.Invoke()
at System.Windows.Threading.Dispatcher.ProcessQueue()
at System.Windows。 Threading.Dispatcher.WndProcHook(IntPtr hwnd,Int32 msg,IntPtr wParam,IntPtr lParam,Boolean&处理)
at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd,Int32 msg,IntPtr wParam,IntPtr lParam,Boolean& processed)
at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback,Object args,Int32 numArgs)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source,Delegate callback,Object args,Int32 numArgs,Delegate catchHandler )
在System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority,TimeSpan timeout,Delegate方法,Object args,Int32 numArgs)
at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd,Int32 msg, IntPtr wParam,IntPtr lParam)
at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
at System.Windows。 System.Windows.Application.RunDi上的Threading.Dispatcher.PushFrame(DispatcherFrame框架)
spatcher(Object ignore)
at System.Windows.Application.RunInternal(Window window)
at System.Windows.Application.Run(Window window)
at Microsoft.VisualStudio.DesignTools.DesignerContract。 Isolation.DesignerProcess.RunApplication()
。在Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.DesignerProcess<> c__DisplayClass3_0<主>在System.Threading.ThreadHelper.ThreadStart_Context b__0()
(对象状态)
在System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext,ContextCallback callback,Object state,Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext,ContextCallback callback,Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext,ContextCallback callback,Object state)
at System.Threading.ThreadHelper.ThreadStart()

第一次加载很好并显示f orm但是一旦我想改变XAML代码,上面的错误就会在设计师中显示出来。单击"单击她以重新加载设计器"选项时,视图将再次显示。


搜索解决方案但没有一个正在运行,或者给我一个问题来自何处。


一个解决方案是删除我做过的privateregistry.bin但是没有用。


每个view / form / usercontrol都会出现问题,即使是新创建的一个。


构建项目没问题,一切正常。



有人可以帮我搞定摆脱这个问题?



问候,


Ernst Jan


解决方案


嗨Ernst Jan Reinders,



欢迎来到MSDN论坛。



你能否创建一个新的WPF项目来测试它是否再次出现?你想要更改XAML代码会出现这个错误吗?



您是否在其他项目类型中遇到相同的错误?如果可能,最好分享一个演示以便在我们的方面重现此错误,请将其上传到
https://onedrive.live.com/ 并在此处分享链接。


期待您的回复。



可能



Hi,

Have a problem with a new installation of Visual Studio 2017 - Version 15.9.9 on new notebook.

Installation did not have any problem. Loaded project I am working on without a problem.

But WPF designer is showing the next error

System.UnauthorizedAccessException
Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))
   at System.Reflection.RuntimeAssembly.nLoadFile(String path, Evidence evidence)
   at System.Reflection.Assembly.LoadFile(String path)
   at Microsoft.VisualStudio.DesignTools.Utility.AssemblyHelper.LoadFile(String path, Action`1 logger)
   at Microsoft.VisualStudio.DesignTools.Designer.Metadata.Assemblies.AssemblyService.CreateClassicShadowCopy(String assemblyPath, String projectPath, ReferenceAssemblyContext context, Boolean useReflectionOnlyLoad)
   at Microsoft.VisualStudio.DesignTools.Designer.Metadata.Assemblies.AssemblyService.ResolveShadowCopyAssembly(String assemblyPath, String projectPath, ReferenceAssemblyContext context, Boolean useReflectionOnlyLoad)
   at Microsoft.VisualStudio.DesignTools.Designer.Metadata.Assemblies.AssemblyService.ResolveAssembly(String assemblyPath, String assemblyFullName, String projectPath, ReferenceAssemblyContext context, Boolean useReflectionOnlyLoad)
   at Microsoft.VisualStudio.DesignTools.Designer.Metadata.Assemblies.ProjectAssemblyResolver.GetAssemblyInformationInternal(String path)
   at Microsoft.VisualStudio.DesignTools.Designer.Metadata.Assemblies.ProjectAssemblyResolver.GetAssemblyInformation(String assemblyLocation)
   at Microsoft.VisualStudio.DesignTools.Designer.Metadata.Assemblies.ProjectAssemblyResolver.InternalAddAssemblyReference(String assemblyLocation)
   at Microsoft.VisualStudio.DesignTools.Designer.Metadata.Assemblies.ProjectAssemblyResolver.UpdateAssemblyReferences(IEnumerable`1 referencesToUpdate)
   at Microsoft.VisualStudio.DesignTools.Designer.Metadata.Assemblies.ProjectAssemblyResolver.Initialize()
   at Microsoft.VisualStudio.DesignTools.Designer.Metadata.Assemblies.ProjectAssemblyService.GetProjectAssemblyResolver(IHostProject project)
   at Microsoft.VisualStudio.DesignTools.Designer.Metadata.Assemblies.ProjectAssemblyService.CreatePlatformReferenceAssemblyResolver(IHostProject project)
   at Microsoft.VisualStudio.DesignTools.Designer.Documents.Project.ProjectContextManager.CreatePlatformReferenceAssemblyResolver(IHostProject project)
   at Microsoft.VisualStudio.DesignTools.Designer.Documents.Project.ProjectContextManager.GetProjectContext(IHostProject project, IPlatform platform, Boolean create)
   at Microsoft.VisualStudio.DesignTools.Designer.Documents.Project.ProjectContextManager.<GetContextsInActiveSolution>d__94.MoveNext()
   at Microsoft.VisualStudio.DesignTools.XamlDesigner.Commands.ReplaceStyleTemplateCommand.ResolveDefaultStyle(SceneNode targetElement, Object defaultStyleKey, Boolean allowDefaultStyle, DocumentNode& currentStyle, Boolean& isThemeStyle, IList`1& auxiliaryResources)
   at Microsoft.VisualStudio.DesignTools.XamlDesigner.Commands.ReplaceStyleTemplateCommand.ProvideCurrentStyle(SceneNode targetElement, IType targetType, PropertyReference targetPropertyReference, Boolean allowDefaultStyle, IList`1& auxiliaryResources)
   at Microsoft.VisualStudio.DesignTools.XamlDesigner.Commands.EditCopyOfStyleCommand.get_IsEnabled()
   at Microsoft.VisualStudio.DesignTools.Utility.Commands.Command.GetProperty(String propertyName, Object defaultValue)
   at Microsoft.VisualStudio.DesignTools.XamlDesigner.Commands.ReplaceStyleTemplateCommand.GetProperty(String propertyName)
   at Microsoft.VisualStudio.DesignTools.Utility.Commands.CommandTarget.<>c__DisplayClass21_0.<GetCommandProperty>b__0()
   at Microsoft.VisualStudio.DesignTools.Utility.ProtectionZone.DummyProtectionZone.Execute[T](Func`1 func)
   at Microsoft.VisualStudio.DesignTools.Utility.Commands.CommandTarget.GetCommandProperty(String commandName, String propertyName)
   at Microsoft.VisualStudio.DesignTools.Designer.Views.SceneView.UpdateCommandState(IEnumerable`1 commandNames, Boolean forceRefresh)
   at Microsoft.VisualStudio.DesignTools.Designer.Views.SceneView.SelectionManager_LateActiveSceneUpdatePhase(Object sender, SceneUpdatePhaseEventArgs args)
   at Microsoft.VisualStudio.DesignTools.Designer.ViewModel.SceneUpdatePhaseEventHandler.Invoke(Object sender, SceneUpdatePhaseEventArgs e)
   at Microsoft.VisualStudio.DesignTools.Designer.ViewModel.Selection.SelectionManager.FireLateActiveSceneUpdatePhase(SceneUpdatePhaseEventArgs args)
   at Microsoft.VisualStudio.DesignTools.Designer.Views.SceneViewUpdateScheduleTask.UpdateLate()
   at Microsoft.VisualStudio.DesignTools.Utility.Scheduler.ScheduleTask.Update()
   at Microsoft.VisualStudio.DesignTools.Utility.Scheduler.SchedulingService.DispatchTasksAtPriority(DispatcherPriority priority)
   at Microsoft.VisualStudio.DesignTools.Utility.Scheduler.SchedulingService.DispatcherToken.Dispatch(Object arg)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
   at System.Windows.Threading.DispatcherOperation.InvokeImpl()
   at System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(Object state)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at MS.Internal.CulturePreservingExecutionContext.Run(CulturePreservingExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Windows.Threading.DispatcherOperation.Invoke()
   at System.Windows.Threading.Dispatcher.ProcessQueue()
   at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
   at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
   at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
   at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
   at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
   at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
   at System.Windows.Application.RunDispatcher(Object ignore)
   at System.Windows.Application.RunInternal(Window window)
   at System.Windows.Application.Run(Window window)
   at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.DesignerProcess.RunApplication()
   at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.DesignerProcess.<>c__DisplayClass3_0.<Main>b__0()
   at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ThreadHelper.ThreadStart()

The first load is fine and shows the form but as soon I want to change and of the XAML code the above error shows in designer. When clicking the option 'Click her to reload the designer' the view is showing again.

Have search for solutions but none is working or give me a clue where there problem comes from.

One solution was to remove privateregistry.bin which I did but that did not work.

Problem occurs with every view/form/usercontrol even newly created one.

Building the project is no problem and everything works.

Can someone please help me get rid of this problem?

Greetings,

Ernst Jan

解决方案

Hi Ernst Jan Reinders,

Welcome to the MSDN forum.

Could you create a new WPF project to test if it occurs again? does this error occurs in you want to change XAML code?

Have you meet same error in other project type? If possible, it’s better to share a demo in order to repro this error in our side, please upload it to https://onedrive.live.com/ and share the link here.

Looking forwards your reply.

May


这篇关于WPF设计器 - 拒绝访问0x80070005的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆