Andrey Epifantsev
Andrey Epifantsev

Reputation: 1104

MAUI Windows application: COMException error: No installed components found

I am writing a simple GUI application for MAUI. I am debugging it under Windows. The GUI of the application is a table based on Maui.Controls.Grid. The cells of the table contain buttons for managing these cells. This function adds elements to the table:

private void OnAddHomeworkClicked(object sender, EventArgs e)
{
    var button = (Button)sender;
    int column = ScheduleGrid.GetColumn(button);
    int row = ScheduleGrid.GetRow(button);

    if (column >= 4) return;

    Entry homeworkEntry = new Entry();
    ScheduleGrid.Children.Add(homeworkEntry);
    ScheduleGrid.SetRow(homeworkEntry, row);
    ScheduleGrid.SetColumn(homeworkEntry, column);

    var deleteButton = CreateDeleteButtonForHomework(homeworkEntry);
    ScheduleGrid.Children.Add(deleteButton);
    ScheduleGrid.SetRow(deleteButton, row);
    ScheduleGrid.SetColumn(deleteButton, column);

    ScheduleGrid.Children.Remove(button);
    ScheduleGrid.Children.Add(button);
    ScheduleGrid.SetRow(button, row);
    ScheduleGrid.SetColumn(button, column + 1);
}

ScheduleGrid definition:

private global::Microsoft.Maui.Controls.Grid ScheduleGrid;

XAML code:

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
         xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
         x:Class="автономный_дневник_2.MainPage">

    <StackLayout Padding="10">
        <Label Text="Реестр предметов"
               FontSize="Large"
               HorizontalOptions="Center"
           Margin="0,20,0,20" />

        <Grid x:Name="ScheduleGrid"
              RowSpacing="1"
              ColumnSpacing="1"
              Margin="0,10,0,10"
              RowDefinitions="*,*,*,*,*,*,*,*,*,*"
              ColumnDefinitions="*,*,*,*,*">
            <Button Text="+" Grid.Row="0" Grid.Column="0" Clicked="OnAddSubjectClicked"/>
        </Grid>
        <Button Text="Go to Second Page"
                VerticalOptions="End"
                HorizontalOptions="End"
                Clicked="OnNavigateButtonClicked" />
        </StackLayout>
</ContentPage>

This function adds homeworkEntry and deleteButton to the cell where the pressed button is, and removes the pressed button from there and moves it to the next free cell.

When it executes the line ScheduleGrid.Children.Add(button);, an exception System.Runtime.InteropServices.COMException is thrown with the error message: No installed components were found. Error code: 800F1000, which actually means the same. What components are not installed is a mystery.

Call stack:

 at WinRT.DelegateExtensions.DynamicInvokeAbi(Delegate del, Object[] invoke_params)
 at ABI.System.Collections.Generic.IListMethods`2.InsertAtDynamic(IObjectReference obj, UInt32 index, T value)
 at ABI.System.Collections.Generic.IVectorMethods`1.InsertAt(IObjectReference obj, UInt32 index, T value)
 at ABI.System.Collections.Generic.IListMethods`1.InsertAtHelper(IObjectReference obj, UInt32 index, T item)
 at ABI.System.Collections.Generic.IListMethods`1.Insert(IObjectReference obj, Int32 index, T item)
 at Microsoft.UI.Xaml.Controls.UIElementCollection.Insert(Int32 index, UIElement item)
 at Microsoft.Maui.Handlers.LayoutHandler.Add(IView child)
 at Microsoft.Maui.Handlers.LayoutHandler.MapAdd(ILayoutHandler handler, ILayout layout, Object arg)
 at Microsoft.Maui.CommandMapper`2.<>c__DisplayClass6_0.<Add>b__0(IElementHandler h, IElement v, Object o)
 at Microsoft.Maui.CommandMapper.InvokeCore(String key, IElementHandler viewHandler, IElement virtualView, Object args)
 at Microsoft.Maui.CommandMapper.Invoke(IElementHandler viewHandler, IElement virtualView, String property, Object args)
 at Microsoft.Maui.Handlers.ElementHandler.Invoke(String command, Object args)
at Microsoft.Maui.Controls.Layout.NotifyHandler(String action, Int32 index, IView view)
at Microsoft.Maui.Controls.Layout.OnAdd(Int32 index, IView view)
at Microsoft.Maui.Controls.Grid.OnAdd(Int32 index, IView view)
at Microsoft.Maui.Controls.Layout.Add(IView child)

How to determine which components are missing?

Upvotes: 0

Views: 146

Answers (0)

Related Questions