I\'m working on a WPF application with Visual Studio 2010, using Telerik
.
I have been dealing with a lot of crashes ev
I believe the problem you are seeing is related to one of the controls you are using.
Let me first show you a way of reproducing this problem; if it is the same issue you are seeing. (I'm using VS 2013 which handles this issue a little better than vs 2010)
Firstly, I created a custom control which is a TextBox; and I have code that looks something like this.
public class CustomTextBox : TextBox
{
public string testText { get; set; }
public CustomTextBox()
: base()
{
if (string.IsNullOrEmpty(testText))
{
throw new ArgumentNullException();
}
}
}
then I put this control into the xaml
<Grid>
<local:CustomTextBox/>
</Grid>
All I'm doing is throwing an exception when a property is null when the control calls its constructor (which it will do when in the designer as the designer attempts to new it up and render it).
In VS2013 I simply have a red line underneath the control in the XAML itself, but from past experience with VS2010 this issue did cause the designer to fall over.
What I may suggest you do, is go through the XAML without the designer and take out any 3rd party/custom control's one at a time. One of these controls may be throwing an exception which can produce what you are seeing. If its one of the Telerik controls, contacting them is a option.
Try initializing runtimeType object with typeof(Type) as
Type runtimeType = typeof(Type)
Also evaluate the value of variables reflectionType,this,this._targetFrameworkProvider and this._targetFrameworkProvider.GetRunTimeType(reflectionType)
in a watch during debugging.
This might help you.
Also, I read somewhere that if you start vs as an administrator it gives you issues, try starting Visual studio not as Admin
Read This, a couple of random things you can try..
If you think that it might be related to a component you are using, you may want to try and debug the Visual Studio Design mode and see in which scenario the ArgumentNullException
is thrown or at least get the CallStack when the exception is thrown.
See this link : How to troubleshoot and debug Visual Studio design mode errors?
I personally do it with an instance of Blend and one instance of Visual Studio instead of two instances of Visual Studio.
I would also try from a complete new project without any external dependencies to see if it could be related to your Visual Studio Install
I guess, your best bet is to debug Visual Studio!
VS2010 breaking with certain XAML is a fairly well known issue.
Have you tried adding this code to the Load Event of the offending control?
if (System.ComponentModel.DesignerProperties.GetIsInDesignMode(this)) { return; }
What causes the VS 2010 SP1 WPF Designer to crash?