Skip to content

Setting Visibility.Collapsed on ComboBox while DropDownList is open and TextSearch has started causes Catastrophic Crash #8324

Open

Description

Describe the bug

My ChooseYourFood application which is currently on the Microsoft Store was crashing with the following exception message in the App.UnhandledException handler:

3/25/2023 2:36:20 AM: MoveNext
@(Void put_IsDropDownOpen(Boolean)):Error HRESULT E_FAIL has been returned from a call to a COM component.

I removed all of my calls to IsDropDownOpen and the crash with the same exception persisted. Apparently, this crash only happens when the ComboBox list is open and the user types something into the ComboBox which is not currently displayed and the user's selection requires hiding the existing ComboBox.

Steps to reproduce the bug

  1. Launch Visual Studio and create a new UWP App.
  2. Add a ComboBox to the MainPage XML with IsEditable and IsTextSearchEnabled True and a CharacterReceived event:
  <ComboBox x:Name="ThisComboBox" IsEditable="True" IsTextSearchEnabled="True" Width="160" CharacterReceived="ThisComboBox_CharacterReceived"/>
  1. Populate the ComboBox with enough items to require two pages, for example in the Public MainPage event add after this.InitializeComponent:
   System.String newString = null;
   Windows.UI.Xaml.Controls.ComboBoxItem newComboBoxItem = null;
   for (int i = 0; i < 100; i++)
   {
    newComboBoxItem = new Windows.UI.Xaml.Controls.ComboBoxItem();
    newString = new System.String(i.ToString("00").ToCharArray());
    newComboBoxItem.Content = newString;
    this.ThisComboBox.Items.Add(newComboBoxItem);
   }
  1. In the ThisComboBox_CharacterReceived event hide the ComboBox by add the following:
   this.ThisComboBox.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
  1. Build then launch the application.
  2. Open the ComboBox DropDownList
  3. Press a number greater than 2.
    Result: Catastrophic Failure

Expected behavior

ComboBox is hidden

Screenshots

No response

NuGet package version

None

Windows version

Edition: Windows 10 Pro
Version: 22H2
OS build 19045.2728

Additional context

No response
MainPage.xaml.txt
MainPage.xaml.cs.txt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions