0

在 VS2010 中打开 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、Microsoft Silverlight 3 SDK 和 Microsoft Silverlight 4 SDK 都安装了。在我遇到此异常的项目中,我使用的是 Silverlight 3 SDK。

我该如何解决这个问题?

4

2 回答 2

0

用记事本打开 *.csproj 文件并检查以下行:

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

它必须存在于 *.csproj 文件中。

于 2012-11-11T11:17:10.327 回答
0

检查 xaml 实现代码中的 silverlight 代码,似乎变量 d__8 未填充或为空或未引用..

检查这个 http://social.msdn.microsoft.com/Forums/en/vswpfdesigner/thread/01ce533e-ed94-48d2-8184-e2e34e6bdc6f

于 2012-11-10T20:56:59.353 回答