Visual Studio崩溃
我正在使用Mvvm Light(最新版本)构建Silverlight 4应用程序,而VS 2010每5分钟甚至更少崩溃。所以这是不可能的。Visual Studio崩溃
我相信这是因为我正在做或者我的MVVM实现有问题。
我在设计师有时会得到这个错误。
An unhandled exception has occurred:
[Xml_CannotFindFileInXapPackage]
Arguments: ServiceReferences.ClientConfig
Debugging resource strings are unavailable. Often the key and arguments provide sufficient information to diagnose the problem. See http://go.microsoft.com/fwlink/?linkid=106663&Version=4.0.60129.0&File=System.Xml.dll&Key=Xml_CannotFindFileInXapPackage
at System.Xml.XmlXapResolver.GetEntity(Uri absoluteUri, String role, Type ofObjectToReturn)
at System.Xml.XmlReaderSettings.CreateReader(String inputUri, XmlParserContext inputContext)
at System.Xml.XmlReader.Create(String inputUri, XmlReaderSettings settings, XmlParserContext inputContext)
at System.ServiceModel.Configuration.ServiceModelSectionGroup.GetSectionGroup()
I don't know if this is related with the crash.
..And I found this error in the event viewer:
Application: devenv.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.ObjectDisposedException
Stack:
at System.Windows.Threading.Dispatcher.FastInvoke(System.Windows.Threading.DispatcherPriority, System.Delegate, System.Object[])
at System.Net.Browser.AsyncHelper.CheckUseLowLatencyNetworking()
at System.Net.Browser.AsyncHelper.BeginOnUI(System.Threading.SendOrPostCallback, System.Object)
at System.Net.Browser.BrowserHttpWebRequest.Abort()
at System.ServiceModel.Channels.HttpOutput+WebRequestHttpOutput.Abort(System.ServiceModel.Channels.HttpAbortReason)
at System.ServiceModel.Channels.HttpChannelFactory+HttpRequestChannel+HttpChannelAsyncRequest.AbortSend()
at System.ServiceModel.Channels.HttpChannelFactory+HttpRequestChannel+HttpChannelAsyncRequest.OnSendTimeout(System.Object)
at System.Threading._TimerCallback.TimerCallback_Context(System.Object)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Threading._TimerCallback.PerformTimerCallback(System.Object)
任何帮助将不胜感激,在此先感谢。
我有一个类似的问题,因为每当我在设计器中打开一个XAML文件时,VS都会崩溃。原来,在对我的Model进行了一些更改之后,我的设计时数据通过属性验证器并通过一个例外。我最好的猜测是,在ViewModel中发生了一件非常错误的事情,它被VS实例化为设计师的后盾。
@Robaticus,是的我正在使用WCF,但我不知道我是否“意外地”试图在设计模式下检索数据。我不知道在设计模式下MVVM Light是做什么的,也许它试图做到这一点?我曾多次使用Silverlight的WCF,而我甚至不知道如何在设计模式下从WCF中检索数据。
@vortex,我检查了Servicereference.clientconfig的属性,它已经设置为内容。
谢谢你们。
您应该修改代码以处理在Visual Studio下处于设计模式并且您不希望Visual Studio Visual Designer运行任何自定义WCF代码或任何可能失败的事情的情况案件。
下面是对这个问题有好的文章:Detecting design time mode in WPF and Silverlight
这也有可能是的Visual Studio 2010 SP1已经修复了这个问题(至少处理得更加优雅...)
至于我知道Simon,这是由MVVM Light工具包管理的。实际上,在ViewModel类的构造函数中,我有一个检查: /// ///初始化MainViewModel类的新实例。 /// public MainViewModel() if(IsInDesignMode) {Code}在Blend中运行 - >创建设计时数据。
}
else
{
GetDataFromWebService();
}
谢谢你的方式,确实很不错的文章。
你也使用WCF吗?您是否意外地尝试在设计模式下检索数据? – Robaticus 2011-03-25 19:33:36
检查项目中是否存在ServiceReferences.ClientConfig文件,如果存在,打开该文件的属性并设置BuildAction = Content – vorrtex 2011-03-25 19:52:54