Skip to content

System.Runtime.InteropServices.COMException thrown when adding a Label to Grid #10406

@KarthikRajaKalaimani

Description

@KarthikRajaKalaimani

Describe the bug

The exception "System.Runtime.InteropServices.COMException: 'No installed components were detected'" occurs when attempting to add a label to a newly created grid, even though the label's parent is confirmed to be null prior to adding it to the grid.

Grid x:Name="OuterGrid"> <Grid x:Name="InnerGrid"> <TextBlock Text="My Label" x:Name="MyLabel"></TextBlock> </Grid> </Grid>

private void MainWindow_SizeChanged(object sender, WindowSizeChangedEventArgs args)
{
this.OuterGrid.Children.Remove(this.InnerGrid);
this.InnerGrid = new Grid();
this.InnerGrid.Children.Add(MyLabel);
this.OuterGrid.Children.Add(InnerGrid);

}

Steps to reproduce the bug

  1. Run the attached sample.
  2. Once deployed, maximize the window.
  3. Observe that the exception occurs at this point.

Expected behavior

Exception should not occur if the Label parent is null.

Screenshots

No response

NuGet package version

WinUI 3 - Windows App SDK 1.6.5: 1.6.250205002

Windows version

Windows 11 (24H2): Build 26100

Additional context

No response

Metadata

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