本文介绍了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


解决方案

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

解决方案


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

07-16 23:29
查看更多