繁体   English   中英

VS2015 XAML 设计器总是 System.UnauthorizedAccessException

[英]VS2015 XAML Designer always System.UnauthorizedAccessException

我有 VS2015 并且遇到 System.UnauthorizedAccessException 的 XAML 设计器错误。 我在 Windows 10 build 10586 上运行。

当我从项目中删除一些文件时,我没有遇到错误。 构建项目后,运行的 UWP 应用程序以及调试器和 XAML 设计器开始抛出如下错误:

System.UnauthorizedAccessException
Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))
    at System.RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMarkHandle stackMark, IntPtr pPrivHostBinder, Boolean loadTypeFromPartialName, ObjectHandleOnStack type)
    at System.RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean loadTypeFromPartialName)
    at System.Runtime.DesignerServices.WindowsRuntimeDesignerContext.GetType(String typeName)
    at Microsoft.VisualStudio.DesignTools.Utility.WindowsRuntimeService.WindowsRuntimeContext.GetTypeFromWindowsRuntimeDesignerContext(String name)
    at Microsoft.VisualStudio.DesignTools.Utility.WindowsRuntimeService.GetRuntimeType(String typeFullName)
    at Microsoft.VisualStudio.DesignTools.XamlDesigner.Metadata.MockTypes.EmitContext.GetTypeFromRuntimeService(Type type)
    at Microsoft.VisualStudio.DesignTools.XamlDesigner.Metadata.MockTypes.EmitContext.GetPlatformTypeInternal(Type type, Func`2 getPlatformType)
    at Microsoft.VisualStudio.DesignTools.XamlDesigner.Metadata.MockTypes.EmitContext.GetPlatformTypeInternal(Type type)
    at Microsoft.VisualStudio.DesignTools.XamlDesigner.Metadata.MockTypes.EmitContext.GetPlatformType(Type type)
    at Microsoft.VisualStudio.DesignTools.XamlDesigner.Metadata.MockTypes.MockTypeGenerator.GetKnownType(Type type)
    at Microsoft.VisualStudio.DesignTools.XamlDesigner.Metadata.MockTypes.MockTypeGenerator.DefineType(Type type)
    at Microsoft.VisualStudio.DesignTools.XamlDesigner.Metadata.MockTypes.MockTypeGenerator.MockType(Type type)
    at Microsoft.VisualStudio.DesignTools.XamlDesigner.Metadata.MockType.InitializeMockType()
    at Microsoft.VisualStudio.DesignTools.XamlDesigner.Metadata.MockType.get_RuntimeType()
    at Microsoft.VisualStudio.DesignTools.Platform.Metadata.ProjectContextType.InitializeClass()
    at Microsoft.VisualStudio.DesignTools.Platform.Metadata.MemberCollection.get_AttachedPropertyIndex()
    at Microsoft.VisualStudio.DesignTools.Platform.Metadata.MemberCollection.CreateAttachedProperty(String propertyName, MemberKey& key)
    at Microsoft.VisualStudio.DesignTools.Platform.Metadata.MemberCollection.CreateMember(MemberType memberTypes, String memberName, MemberKey& key)
    at Microsoft.VisualStudio.DesignTools.Platform.Metadata.MemberCollection.TryGetCachedMember(MemberType memberTypes, String memberName, Boolean create, IMember& member)
    at Microsoft.VisualStudio.DesignTools.Platform.Metadata.MemberCollection.GetMember(MemberType memberTypes, String memberName, MemberAccessTypes access)
    at Microsoft.VisualStudio.DesignTools.Platform.Metadata.ProjectContextType.GetMember(MemberType memberTypes, String memberName, MemberAccessTypes access)
    at Microsoft.VisualStudio.DesignTools.Designer.UI.PropertyMerger.GetPropertiesFromSelection(IEnumerable`1 selectedSceneNodes, Boolean includeStatics)
    at Microsoft.VisualStudio.DesignTools.Designer.UI.PropertyMerger.GetMergedProperties(IEnumerable`1 selectedSceneNodes, Boolean includeStatics)
    at Microsoft.VisualStudio.DesignTools.Designer.UI.PropertyInspector.PropertyInspectorModel.GetPropertiesToShowInternal(IReadOnlyList`1 selectedObjects)
    at Microsoft.VisualStudio.DesignTools.Designer.UI.PropertyInspector.PropertyInspectorModel.GetRenderedProperties(IReadOnlyList`1 selectedObjects)
    at Microsoft.VisualStudio.DesignTools.Designer.UI.PropertyInspector.PropertyInspectorModel.UpdateOnSelectionChanged(Boolean forceUpdate, Boolean shouldCloseOpenTransactions, Boolean clearAddedProperties)
    at Microsoft.VisualStudio.DesignTools.Designer.UI.PropertyInspector.PropertyInspectorModel.UpdateSelectionCore(Boolean forceUpdate, Boolean shouldCloseOpenTransactions, Boolean clearAddedProperties)
    at Microsoft.VisualStudio.DesignTools.Designer.UI.PropertyInspector.PropertyInspectorModel.UpdateSelection(Boolean forceUpdate, Boolean shouldCloseOpenTransactions, Boolean clearAddedProperties)
    at Microsoft.VisualStudio.DesignTools.Designer.UI.PropertyInspector.PropertyInspectorModel.PropertyManager_MultiplePropertyReferencesChanged(Object sender, MultiplePropertyReferencesChangedEventArgs args)
    at Microsoft.VisualStudio.DesignTools.Designer.Properties.PropertyManager.FireAllPropertyChangedEvents(SceneUpdatePhaseEventArgs args)
    at Microsoft.VisualStudio.DesignTools.Designer.Properties.PropertyManager.SelectionManager_LateActiveSceneUpdatePhase(Object sender, SceneUpdatePhaseEventArgs args)
    at Microsoft.VisualStudio.DesignTools.Designer.ViewModel.SceneUpdatePhaseEventHandler.Invoke(Object sender, SceneUpdatePhaseEventArgs e)
    at Microsoft.VisualStudio.DesignTools.Designer.Selection.SelectionManager.FireLateActiveSceneUpdatePhase(SceneUpdatePhaseEventArgs args)
    at Microsoft.VisualStudio.DesignTools.Designer.View.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 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.DesignProcessViewProvider.AppContainerDesignerProcessRun(String[] activationContextArgs)
    at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.DesignerProcess.DesignProcessViewProvider.<>c__DisplayClass3_0.<applicationView_Activated>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()

我无法看到元素 Grid 的属性,即使是如下简单的语法:

<Page
    x:Class="mstesting.BlankPage1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:mstesting"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d">

    <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">

    </Grid>
</Page>

我已经在 Windows 10 上启用了开发者模式。

更新到 VS2015 Update 1 确实解决了这个问题。

从错误信息来看,用户没有权限。 您可以让应用程序池使用合适的帐户(例如 LocalSystem)。

这是有关此问题的链接

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM