Silverlight设计器:错误为“发生了未处理的异常” [英] Silverlight designer :An error as "An unhandled exception has occurred "

查看:53
本文介绍了Silverlight设计器:错误为“发生了未处理的异常”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  if     XAML   file    已关闭    open   it      span      Design   view       WPF  设计师: 

未处理 例外 发生

点击 此处 重新加载 designer

详细信息: 系统 NullReferenceException
对象 参考 set 实例 对象
Microsoft Windows 设计平台 SilverlightMetadataContext 。< span class =code-leadattribute> SilverlightXamlExtensionImplementations
。< GetXmlNamespaceCompatibilityMappings> d__8.MoveNext()
at MS 内部设计元数据 ReflectionProjectNode .BuildSubsumption()
MS 内部设计 Metad ata ReflectionProjectNode .SubsumingNamespace(Identifier identifier)
at MS 内部设计 Markup XmlElement .BuildScope(PrefixScope parentScope IParseContext context)
at MS 内部设计标记 XmlElement .ConvertToXaml(XamlElement parent PrefixScope parentScope IParseContext context IMarkupSourceProvider provider)
at MS Internal . Design DocumentModel DocumentTrees Markup XamlSourceDocument .FullParse(Boolean convertToXamlWithErrors)
at MS 内部设计 DocumentModel DocumentTrees Markup . XamlSourceDocument .get_RootItem()
Microsoft Windows Design DocumentModel Trees ModifiableDocumentTree .get_ModifiableRootItem()
at < span class =code-leadattribute> Microsoft
Windows Design DocumentModel MarkupDocumentManagerBase .get_LoadState()
at MS 内部主机。< span class =code-leadattribute> PersistenceSu bsystem .Load()
at MS 内部主机设计器 .Load()
< span class =code-leadattribute> at MS 内部 Designer VSDesigner .Load()
at MS 内部 Designer VSIsolatedDesigner VSIsolatedView .Load()
at MS 内部 Designer VSIsolatedDesigner VSIsolatedDesignerFactory .Load(IsolatedView视图)
位于 MS 内部主机隔离 IsolatedDesigner BootstrapProxy .LoadDesigner(IsolatedDesignerFactory factory IsolatedView 视图)
at MS 内部主机隔离 IsolatedDesigner Bootstr apProxy .LoadDesigner(IsolatedDesignerFactory factory IsolatedView 视图)
位于 MS 内部主机隔离 IsolatedDesigner .Load()
at MS 内部 Designer DesignerPane .LoadDesignerView()

解决方案

只是,我安装Visual Studio 2010 Service pack1然后我的设计表单(XAML)页面被加载..

问题是我没有安装Visual Studio 2010 Service pack1''方式错误上升..thanku
您好。我猜你有一个控件有一些属性,如DataGrid.ItemsSource,你在后面的代码中填充它。我想我们是一个DataGrid,它的名字是MainDataGrid。你的Xaml是这样的(例如):



 <   DataGrid     x:名称  =  MainDataGrid   已加载  =  MainDataGrid_Loaded >  

< / DataGrid >





in你的代码必须写下:

使用System.ComponentModel;



然后:

 private void MainDataGrid_Loaded(object sender,RoutedEventArgs e)
{
i f(!DesignerProperties.GetIsInDesignMode(this))
{
MainDataGrid.ItemsSource = //返回列表或列表的方法< yourSpecifiedType >
}
}





也许你的ItemsSource被空填充。



祝你好运


if the XAML file is closed and you open it, the following message appears in Design view of the WPF Designer:

An unhandled exception has occurred.

Click here to reload the designer

Details: System.NullReferenceException
Object reference not set to an instance of an object.
   at Microsoft.Windows.Design.Platform.SilverlightMetadataContext.SilverlightXamlExtensionImplementations.<GetXmlNamespaceCompatibilityMappings>d__8.MoveNext()
   at MS.Internal.Design.Metadata.ReflectionProjectNode.BuildSubsumption()
   at MS.Internal.Design.Metadata.ReflectionProjectNode.SubsumingNamespace(Identifier identifier)
   at MS.Internal.Design.Markup.XmlElement.BuildScope(PrefixScope parentScope, IParseContext context)
   at MS.Internal.Design.Markup.XmlElement.ConvertToXaml(XamlElement parent, PrefixScope parentScope, IParseContext context, IMarkupSourceProvider provider)
   at MS.Internal.Design.DocumentModel.DocumentTrees.Markup.XamlSourceDocument.FullParse(Boolean convertToXamlWithErrors)
   at MS.Internal.Design.DocumentModel.DocumentTrees.Markup.XamlSourceDocument.get_RootItem()
   at Microsoft.Windows.Design.DocumentModel.Trees.ModifiableDocumentTree.get_ModifiableRootItem()
   at Microsoft.Windows.Design.DocumentModel.MarkupDocumentManagerBase.get_LoadState()
   at MS.Internal.Host.PersistenceSubsystem.Load()
   at MS.Internal.Host.Designer.Load()
   at MS.Internal.Designer.VSDesigner.Load()
   at MS.Internal.Designer.VSIsolatedDesigner.VSIsolatedView.Load()
   at MS.Internal.Designer.VSIsolatedDesigner.VSIsolatedDesignerFactory.Load(IsolatedView view)
   at MS.Internal.Host.Isolation.IsolatedDesigner.BootstrapProxy.LoadDesigner(IsolatedDesignerFactory factory, IsolatedView view)
   at MS.Internal.Host.Isolation.IsolatedDesigner.BootstrapProxy.LoadDesigner(IsolatedDesignerFactory factory, IsolatedView view)
   at MS.Internal.Host.Isolation.IsolatedDesigner.Load()
   at MS.Internal.Designer.DesignerPane.LoadDesignerView()

解决方案

Just,I am install Visual Studio 2010 Service pack1 then my design form(XAML)page is loaded..
The problem is i am not install the Visual Studio 2010 Service pack1 that''s way error is rise..thanku


Hi. i guess you have a control that has some property like DataGrid.ItemsSource and you populate it in code behind. i suppose we are a DataGrid and its name is "MainDataGrid".your Xaml is like this(for example):

<DataGrid x:Name="MainDataGrid" Loaded="MainDataGrid_Loaded">

       </DataGrid>



and in your codeBehind you must write:
using System.ComponentModel;

then:

private void MainDataGrid_Loaded(object sender, RoutedEventArgs e)
        {
            if (!DesignerProperties.GetIsInDesignMode(this))
            {
                MainDataGrid.ItemsSource=//a method that return a list or a List<yourSpecifiedType>
            }
        }



maybe your ItemsSource is filled by null.

good luck


这篇关于Silverlight设计器:错误为“发生了未处理的异常”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆