首页 > 解决方案 > 为什么 Visual Studio 2019 UWP XAML 设计器显示空白屏幕?

问题描述

我正在试用 UWP,所以我下载了 Windows BuildCast UWP 测试应用程序,并且正在试用它,但完全无法使用 XAML 设计器!以下是错误(作为图像)
异常的图像 和文本〜

System.NullReferenceException
Object reference not set to an instance of an object.
   at Microsoft.VisualStudio.DesignTools.UwpSurfaceDesigner.Views.UwpIsolatedImageHost.UwpVisualWrapper.CreateWindowCore()
   at Microsoft.VisualStudio.DesignTools.XamlSurfaceDesigner.Views.DisabledHwndHolder.CreateHandle()
   at Microsoft.VisualStudio.DesignTools.UwpSurfaceDesigner.Views.UwpIsolatedImageHost.UwpVisualWrapper..ctor(IntPtr parentHwnd, IDCompositionDevice device, UwpSurfaceProcessDocument document, CancellationToken token)
   at Microsoft.VisualStudio.DesignTools.UwpSurfaceDesigner.Views.UwpIsolatedImageHost.UwpHwndHost.CreateSurfaceHwnd(IntPtr parentHwnd)
   at Microsoft.VisualStudio.DesignTools.XamlSurfaceDesigner.Views.IsolatedSurfaceImageHost.IsolatedHwndHost.BuildWindowCore(HandleRef hwndParent)
   at System.Windows.Interop.HwndHost.BuildWindow(HandleRef hwndParent)
   at System.Windows.Interop.HwndHost.BuildOrReparentWindow()
   at System.Windows.Interop.HwndHost.OnSourceChanged(Object sender, SourceChangedEventArgs e)
   at System.Windows.SourceChangedEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
   at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
   at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
   at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
   at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
   at System.Windows.UIElement.RaiseEvent(RoutedEventArgs e)
   at System.Windows.PresentationSource.UpdateSourceOfElement(DependencyObject doTarget, DependencyObject doAncestor, DependencyObject doOldParent)
   at System.Windows.PresentationSource.OnVisualAncestorChanged(DependencyObject uie, AncestorChangedEventArgs e)
   at System.Windows.UIElement.OnVisualAncestorChanged(Object sender, AncestorChangedEventArgs e)
   at System.Windows.Media.Visual.ProcessAncestorChangedNotificationRecursive(DependencyObject e, AncestorChangedEventArgs args)
   at System.Windows.Media.Visual.FireOnVisualParentChanged(DependencyObject oldParent)
   at System.Windows.Media.Visual.AddVisualChild(Visual child)
   at System.Windows.Controls.Decorator.set_Child(UIElement value)
   at Microsoft.VisualStudio.DesignTools.XamlSurfaceDesigner.Views.IsolatedSurfaceImageHost.<CreateSurfaceAsync>d__66.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at Microsoft.VisualStudio.Telemetry.WindowsErrorReporting.WatsonReport.GetClrWatsonExceptionInfo(Exception exceptionObject)

System.AggregateException
One or more errors occurred.

我尝试了几件事-

  1. Visual Studio 安装程序 -> 修复
  2. 检查环境变量(HPD 或 MCD)
  3. 以管理员身份运行 VS
  4. 试图从预览频道获取 VS 来测试这一点
  5. 切换后重新启动 Visual StudioShow XAML Designer
  6. 将目标版本更改为至少 3 个不同的版本

    编辑:我尝试使用新的空白 UWP C# 应用程序,并收到此错误
    错误 #2 的图像

标签: c#windowsvisual-studiouwp

解决方案


推荐阅读