none
WPF designer - Access is denied 0x80070005

    Question

  • 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

    Wednesday, April 10, 2019 7:19 AM

All replies

  • 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


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com

    Wednesday, April 10, 2019 9:04 AM
    Moderator
  • I am having the exact same issue. 
    Tuesday, April 16, 2019 3:04 PM
  • Hi May,

    Sorry for late reply. Was quite busy and forgot to enable alert.

    Created a new project and seems to work. Have no problems with that one.

    Must be something in project that causes this but can't figure out what I need to change to solve it.

    Opened an older wpf project and that one is fine as well.

    Sadly can't upload the project because of size and privacy reasons.

    You have any suggestions?

    Greetings,

    Ernst Jan

    Wednesday, April 17, 2019 8:58 AM
  • Hi Ernst Jan Reinders,

    Based on your description, “When clicking the option 'Click her to reload the designer' the view is showing again.” means everything is backing to normal after reload that, am I right?

    For now, we cannot to reproduce this situation. the project has no problem that detected on the error info you shown above. As my experience, some members met same issue for now and then, but it will disappear once rebuild it directly or clean project – run VS as admin – rebuild.

    Sorry for your inconvenience. Since our forum mainly focus on VS IDE issue, if it occurs again in the future, please go to WPF forum and start a new thread with more detail steps and error info. We will try our best to investigate it.

    May


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com

    Thursday, April 18, 2019 9:56 AM
    Moderator
  • I commented earlier that I get the exact same error. 

    It happens when I use Nuget to load the following package:

    Microsoft.Office.Interop.Excel by Microsoft

    This the assembly to do Office 2013 Excel interop

    • Proposed as answer by Gardner Mass Thursday, April 18, 2019 1:33 PM
    Thursday, April 18, 2019 1:32 PM