Visual studio crashes
I am building a Silverlight 4 application using Mvvm Light(latest version), and VS 2010 crashes every 5 minutes even less. So it is impossible to work.
I believe it is because I am doing or there is something wrong with my MVVM implementation.
I get this error on the designer sometimes.
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(S开发者_Python百科ystem.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)
Any help will be appreciated, thanks in advance.
I have a similar issue, in that VS would crash every time I opened a XAML file in the designer. Turned out that after making some changes to my Model, my designtime data was passing through property validators and through an exception. My best guess is that something very wrong is happening in a ViewModel that it being instantiated by VS to be a backing for the designer.
@Robaticus, yes I am using WCF but I don't know if I am "accidentally" trying to retrieve data while in design mode. I don't know what MVVM Light does while in design mode, perhaps it tries to do that?. I used many times WCF with Silverlight and I don't even know how to retrieve data from WCF while in design mode.
@vortex, I checked the properties of the Servicereference.clientconfig and it is already set to content.
Thank you guys.
You should modify your code to handle the fact that under Visual Studio, you're in Design Mode and you don't want the Visual Studio Visual Designer to run any custom WCF code, or anything that can fail, in this case.
Here is a good article on this subject here: Detecting design time mode in WPF and Silverlight
It's also possible that Visual Studio 2010 SP1 has fixed this issue (at least handling it more gracefully...)
As far as I know, Simon, this is managed by the MVVM Light toolkit. In fact in the constructor of my ViewModel class I have got a check: /// /// Initializes a new instance of the MainViewModel class. /// public MainViewModel() { if (IsInDesignMode) { // Code runs in Blend --> create design time data.
}
else
{
GetDataFromWebService();
}
Thank you by the way, nice article indeed.
精彩评论