1

我刚刚完成了Windows 10 Build 16232的全新安装,并使用 UWP、.NET 和 Xamarin“默认”包安装了Visual Studio Community 2017 Preview 。我创建了一个空白的 UWP 应用程序,放置了一个文本框,然后……出错了。

这是 XAML:

<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
    <TextBox Text="Hello World!"/>
</Grid>

现在,对于错误:

Exception: Unable to create an instance of "TextBox". 

at Microsoft.VisualStudio.DesignTools.Designer.InstanceBuilders.InstanceBuilderOperations.InstantiateType(Type type, Boolean supportInternal)
at Microsoft.VisualStudio.DesignTools.Designer.InstanceBuilders.ClrObjectInstanceBuilder.InstantiateTargetType(ILocalInstanceBuilderContext context, ViewNode viewNode)
at Microsoft.VisualStudio.DesignTools.Designer.InstanceBuilders.ClrObjectInstanceBuilder.Instantiate(ILocalInstanceBuilderContext context, ViewNode viewNode)
at Microsoft.VisualStudio.DesignTools.UwpDesigner.InstanceBuilders.FrameworkElementInstanceBuilder.Instantiate(ILocalInstanceBuilderContext context, ViewNode viewNode)
at Microsoft.VisualStudio.DesignTools.Designer.InstanceBuilders.LocalInstanceManager.CreateInstance(IInstanceBuilder builder, ViewNode viewNode)

TargetInvocationException : Exception has been thrown by the target of an invocation.

at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck)
at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)
at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)
at System.Activator.CreateInstance(Type type, Boolean nonPublic)

AccessViolationException : Attempted to read or write protected memory. This is often an indication that other memory is corrupt.

at Windows.UI.Xaml.Controls.TextBox..ctor()

这是我尝试过的:

  • 调试 x86
  • 调试 ARM
  • 调试 x64
  • 以管理员身份运行
  • chkdsk
  • 重新安装 Visual Studio
  • 重新安装 Windows 10 Build 16232 (慢环)
  • 安装 Visual Studio 社区 2017
  • 卸载 Xamarin
  • 升级到 Windows 10 Build 16241 (快速环)

其他所有常见控件都可以工作,但不是那个。我如何使它工作?问题只出在设计师身上;我可以很好地编译应用程序。

4

1 回答 1

0

感谢您的反馈意见。这是一个已修复的已知问题。正如@Justin XL 所说,您可以将系统更新到Windows 10 Insider Preview Build 16251以解决此问题。这是现在的最新版本。升级后,您可能需要清理和重建项目并重新打开页面,然后TextBox应该能够在 XAML 设计器中显示错误。

于 2017-07-28T10:39:58.707 回答