crash in ComboBox coerce (not my code)

前端 未结 5 1008
臣服心动
臣服心动 2020-12-20 13:20

I got the stack trace below reported from a customer. I don\'t know how to reproduce this. My WPF application has a fair number of ComboBoxes; I\'m not sure how to determine

5条回答
  •  旧时难觅i
    2020-12-20 14:06

    Here's the code (.NET 4.5.2). Either o isn't a ComboBox or HighlightedElement is null.

    Personally, my first step would be to distribute the PDBs so you could get line numbers in the stack trace.

    private static object CoerceIsSelectionBoxHighlighted(object o, object value)
    {
        ComboBox comboBox = (ComboBox)o;
        return (!comboBox.IsDropDownOpen && comboBox.IsKeyboardFocusWithin) ||
               (comboBox.HighlightedInfo != null && comboBox.HighlightedElement.Content == comboBox._clonedElement);
    }
    
    private ComboBoxItem HighlightedElement
    {
        get { return (_highlightedInfo == null) ? null : _highlightedInfo.Container as ComboBoxItem; }
    }
    

提交回复
热议问题