Editing XAML leads Visual Studio's Designer to crash

前端 未结 8 787
长情又很酷
长情又很酷 2021-01-03 21:43

Original Question


I\'m working on a WPF application with Visual Studio 2010, using Telerik.

I have been dealing with a lot of crashes ev

8条回答
  •  执笔经年
    2021-01-03 22:17

    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

    
        
    
    

    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.

提交回复
热议问题