2012-11-10 71 views
0

在VS2010打開一個Silverlight應用程序時,我得到了以下錯誤:當打開Silverlight應用程序發生異常

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() 

現在我想說的是,我的PC的Microsoft Silverlight,微軟的Silverlight 3 SDK和Microsoft Silverlight 4 SDK都已安裝。在我使用Silverlight 3 SDK時出現此異常的項目中。

我怎樣才能解決這個問題?

+0

嘗試刪除項目的「bin」和「obj」文件夾並重建。如果仍然存在問題,請參閱是否可以縮小到一個或兩個XAML頁面/代碼隱藏文件。如果您可以將其縮小到幾個文件,請編輯您的問題以包含您認爲會在VS設計器中導致問題的代碼。沒有這些信息,我們將無法重現您的問題,因此無法進一步幫助您。 –

回答

0

檢查您的XAML實現代碼的Silverlight代碼似乎變量d__8未填充或空或不引用..

檢查這個 http://social.msdn.microsoft.com/Forums/en/vswpfdesigner/thread/01ce533e-ed94-48d2-8184-e2e34e6bdc6f

+0

Microsoft.Windows.Design.Platform.SilverlightMetadataContext.SilverlightXamlExtensionImplementations。 d__8.MoveNext() – Sohail

+0

所以我應該如何解決? – Sohail

+0

好的檢查這可能有助於http://social.msdn.microsoft.com/Forums/en/vswpfdesigner/thread/01ce533e-ed94-48d2-8184-e2e34e6bdc6f – Ibrahim

0

開放*的.csproj用記事本和文件檢查以下行:

<ApplicationDefinition Include="App.xaml"> 
    <Generator>MSBuild:Compile</Generator> 
    <SubType>Designer</SubType> 
</ApplicationDefinition> 

它必須存在於* .csproj文件中。

+0

so我需要在這裏做什麼配置? – Sohail

+0

是的配置是相同的在csproj文件 – Sohail

+0

安裝Microsoft Visual Studio 2010 Service Pack 1. http://www.microsoft.com/en-us/download/details.aspx?id=23691 – Masoomian

相關問題