异常:无法在 Windows 10 Build 16232 中创建 "TextBox" 的实例
Exception: Unable to create an instance of "TextBox" in Windows 10 Build 16232
我刚刚使用 UWP、.NET 和 Xamarin "default" 包对 Windows 10 Build 16232 and installed 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 (快环)
所有其他 common 控制 do 工作,但不是那个。我如何让它发挥作用?问题只出在设计师身上;我可以很好地编译应用程序。
感谢您的反馈。这是一个已修复的已知问题。正如@Justin XL 所说,您可以将系统更新为 Windows 10 Insider Preview Build 16251 以解决此问题。这是现在的最新版本。升级后,您可能需要清理并重建您的项目并重新打开您的页面,然后 TextBox
应该能够在 XAML 设计器中显示错误。
我刚刚使用 UWP、.NET 和 Xamarin "default" 包对 Windows 10 Build 16232 and installed 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 (快环)
所有其他 common 控制 do 工作,但不是那个。我如何让它发挥作用?问题只出在设计师身上;我可以很好地编译应用程序。
感谢您的反馈。这是一个已修复的已知问题。正如@Justin XL 所说,您可以将系统更新为 Windows 10 Insider Preview Build 16251 以解决此问题。这是现在的最新版本。升级后,您可能需要清理并重建您的项目并重新打开您的页面,然后 TextBox
应该能够在 XAML 设计器中显示错误。