我刚刚安装了Windows 10 Build 16232,并使用UWP,.NET和Xamarin“默认”软件包安装了Visual Studio Community 2017 Preview。我创建了一个空白的UWP应用程序,放置了一个TextBox,然后......出错了。
这是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()
这是我试过的:
chkdsk
其他常用控件执行工作,但不是那个。我如何使其工作?问题只出在设计师身上;我可以很好地编译应用程序。
答案 0 :(得分:0)
感谢您的反馈。这是一个已修复的已知问题。正如@Justin XL所说,您可以将系统更新为Windows 10 Insider Preview Build 16251以解决此问题。这是现在的最新版本。升级后,您可能需要清理并重建项目并重新打开页面,然后TextBox
应该能够在XAML Designer中显示错误。