为什么即使Visual Studio中的简单Hello World通用Windows平台应用程序仍然出现“安全句柄已关闭”错误?

问题描述 投票:-1回答:2

每当我通过xaml编辑器打开MainPage.xaml时,我都会收到以下错误。我实际上几乎所有的应用程序都出现此错误。

System.ObjectDisposedException
Safe handle has been closed
   at Microsoft.VisualStudio.DesignTools.HostUtility.Platform.AppContainerProcessDomainFactory.CreateDesignerProcess(String applicationPath, String clientPort, Uri hostUri, IDictionary environmentVariables, Int32& processId, Object& processData)
   at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Primitives.ProcessDomainFactory.ProcessIsolationDomain..ctor(ProcessDomainFactory factory, IIsolationBoundary boundary, AppDomainSetup appDomainInfo, IIsolationTarget isolationTarget, String baseDirectory)
   at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Primitives.ProcessDomainFactory.CreateIsolationDomain(IIsolationBoundary boundary)
   at Microsoft.VisualStudio.DesignTools.HostUtility.Platform.AppContainerProcessDomainFactory.CreateIsolationDomain(IIsolationBoundary boundary)
   at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Primitives.IsolationBoundary.Initialize()
   at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Primitives.IsolationBoundary.CreateInstance[T](Type type)
   at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.IsolatedObjectFactory.Initialize()
   at Microsoft.VisualStudio.DesignTools.DesignerHost.Services.VSIsolationService.CreateObjectFactory(IIsolationTarget isolationTarget, IObjectCatalog catalog)
   at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.IsolationService.CreateLease(IIsolationTarget isolationTarget)
   at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.IsolationService.CreateLease(IIsolationTarget isolationTarget)
   at Microsoft.VisualStudio.DesignTools.DesignerContract.IsolatedDesignerService.CreateLease(IIsolationTarget isolationTarget, CancellationToken cancelToken, DesignerServiceEntry& entry, IServiceProvider serviceOverrides)
   at Microsoft.VisualStudio.DesignTools.DesignerContract.IsolatedDesignerService.IsolatedDesignerView.CreateDesignerViewInfo(CancellationToken cancelToken)
   at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.IsolatedTaskScheduler.InvokeWithCulture[T](CultureInfo culture, Func`2 func, CancellationToken cancelToken)
   at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.IsolatedTaskScheduler.<>c__DisplayClass10_0`1.<StartTask>b__0()
   at System.Threading.Tasks.Task`1.InnerInvoke()
   at System.Threading.Tasks.Task.Execute()
c# .net visual-studio win-universal-app visual-studio-2015
2个回答
1
投票

this link上有一个类似的问题,它通过升级视觉工作室来解决。您可以尝试该链接中的解决方案,也请尝试以下步骤尝试解决您的问题:

如果上述所有问题无法解决您的问题,我担心您需要重新安装Visual Studio。


1
投票

我终于通过一种奇怪的方法解决了这个问题。

我从开发人员模式切换到sideloading启用模式,并尝试重新加载设计器,但未能说我需要开发人员许可证才能这样做。然后我又回到了开发者模式,并再次尝试重新加载设计器。这次它奏效了。

现在,我必须为每个无法加载的项目(包括新项目)执行上述步骤,以便成功加载它们。

一旦XAML设计器成功加载项目,它每次都会成功加载。

© www.soinside.com 2019 - 2024. All rights reserved.