创建新的 Silverlight 项目时出现 System.ArgumentNullException
在查看新创建的 Silverlight 应用程序的 MainPage.xaml 时,我遇到了下面列出的异常。我所说的新创建是指没有任何内容被修改;我只是在 VS 中创建解决方案,并在设计器中加载 xaml 后立即收到错误。
- 我在 Windows XP 上使用 Visual Studio 2010 Professional。
- 整个解决方案构建成功,并且运行似乎没有错误。我说“出现”是因为它是一个空白屏幕;未添加任何控件。
- 我已经多次重新创建解决方案,重新启动 VS,重新启动等。
- 我尝试运行修复/重新安装两次。
- 我已应用通过 Windows Update 提供的所有更新。
- 我尝试过创建 Silverlight 3 和 4 解决方案。
- 我在网上搜索过没有结果。
怎么了?
System.ArgumentNullException
Value cannot be null.
Parameter name: parentContext
at Microsoft.Windows.Design.Metadata.ReflectionMetadataContext..ctor(IMetadataContext parentContext)
at MS.Internal.Host.ProjectMetadataContext..ctor(IMetadataContext platformMetadata, AssemblyReferenceProvider referenceProvider)
at MS.Internal.Host.ProjectMetadataContext.FromReferences(AssemblyReferenceProvider referenceProvider)
at MS.Internal.Designer.VSDesigner.GetMetadataForDesignerContext(DesignerContext designerContext)
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()
I'm getting the exception listed below when looking at the MainPage.xaml of a newly created Silverlight application. By newly created I mean nothing, at all, has been modified; I just create the solution in VS and get the error as soon as it loads the xaml in the designer.
- I'm using Visual Studio 2010 Professional on Windows XP.
- Building the entire solution succeeds and appears to run without error. I say "appears" though because it's a blank screen; no controls have been added.
- I've recreated the solution multiple times, restarted VS, rebooted, etc.
- I've tried running the repair/reinstall twice.
- I've applied all updates available via Windows Update.
- I've tried creating both Silverlight 3 and 4 solutions.
- I've searched the Internet to no avail.
What's wrong?
System.ArgumentNullException
Value cannot be null.
Parameter name: parentContext
at Microsoft.Windows.Design.Metadata.ReflectionMetadataContext..ctor(IMetadataContext parentContext)
at MS.Internal.Host.ProjectMetadataContext..ctor(IMetadataContext platformMetadata, AssemblyReferenceProvider referenceProvider)
at MS.Internal.Host.ProjectMetadataContext.FromReferences(AssemblyReferenceProvider referenceProvider)
at MS.Internal.Designer.VSDesigner.GetMetadataForDesignerContext(DesignerContext designerContext)
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()
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
您是否安装了 Silverlight Developer 运行时?
http://go.microsoft.com/fwlink/?LinkId=146060
Do you have the Silverlight Developer runtime installed ?
http://go.microsoft.com/fwlink/?LinkId=146060
不幸的是,最终不得不重新安装 Windows,但现在可以了。
Ended up having to reinstall Windows, unfortunate, but it works now.
如果有人在创建新的 Windows Phone 项目(使用 Silverlight)时遇到此错误,如果您安装 Windows Phone SDK 7.1(或之后的任何 SDK),应该可以解决此问题。
http://www.microsoft.com/download/en/details.aspx ?id=27570
在安装之前我不需要卸载任何东西。只需下载 vm_web2.exe 并运行它。重新打开VS,新建一个Windows Phone项目,一切应该就OK了。
If anyone is getting this error when making a new Windows Phone project (which uses Silverlight), if you install the Windows Phone SDK 7.1 (or probably any SDK after that), it should fix this problem.
http://www.microsoft.com/download/en/details.aspx?id=27570
I didn't have to uninstall anything before this install. Just download the vm_web2.exe, and run it. Reopen VS, make a brand new Windows Phone project, everything should be OK.
只需卸载所有 silverlight SDK 和工具包,然后重新安装 silverlight 4 工具包即可。不必再次安装 Silverlight 3。它解决了我的问题。
Just uninstall all the silverlight SDK and toolkit, and reinstall silverlight 4 toolkit. Do not have to install Silverlight 3 again. It fix my problem.