System.Runtime.InteropServices.COMException occurs when both DisplayMemberPath and ItemTemplate are set

Author: Jothika4341Created Aug 28, 2026Updated Sep 30, 2026
Labelsbugneeds-triageteam-Controls

Describe the bug

The issue occurs when creating a custom control that inherits from ListView and setting both DisplayMemberPath and ItemTemplate. This combination results in a System.Runtime.InteropServices.COMException. Removing DisplayMemberPath="Name" resolves the issue, and the control works as expected. Could you please confirm whether DisplayMemberPath should not be set when an ItemTemplate is defined? Is this the default behavior, or does it indicate a potential issue?

 <local:CustomAutoComplete DisplayMemberPath="Name"
     ItemsSource="{Binding SocialMedias}">
     <local:CustomAutoComplete.ItemTemplate>
         <DataTemplate>
             <TextBlock Text="{Binding Name}"
                        TextWrapping="Wrap" />
         </DataTemplate>
     </local:CustomAutoComplete.ItemTemplate>
 </local:CustomAutoComplete> 

SimpleApp.zip

Why is this important?

We have a custom control that inherits from ListView. Long strings are added as the item source, and our customer requires these strings to be searchable using the custom control. To achieve this, applied an ItemTemplate that includes TextWrapping="Wrap" in the DataTemplate TextBlock, along with setting DisplayMemberPath="Name". This combination resulted in a System.Runtime.InteropServices.COMException.

Steps to reproduce the bug

  1. Run the sample.
  2. Observe that a System.Runtime.InteropServices.COMException occurs.

Actual behavior

No response

Expected behavior

No response

Screenshots

No response

NuGet package version

Windows App SDK 2.4.0

Windows version

No response

Additional context

No response

Source: microsoft/microsoft-ui-xaml