Приложение MAUI под Windows: ошибка COMException: Не обнаружено установленных компонентов

Пишу простое GUI приложение под MAUI. Отлаживаю его под Windows. GUI приложения представляет собой таблицу на основе Maui.Controls.Grid. В ячейках таблицы вставлены кнопки для управления этими ячейками. Одна из функций добавляющая элементы в таблицу:

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:

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

Соответствующий XAML:

<?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>

Эта функция в ячейку где находится нажатая кнопка добавляет homeworkEntry и deleteButton, а нажатую кнопку оттуда убирает и перемещает её в следующую свободную ячейку.

И почему-то при попытке выполнить строку ScheduleGrid.Children.Add(button); вылетает исключение System.Runtime.InteropServices.COMException с сообщением об ошибке: Не обнаружено установленных компонентов. Код ошибки: 800F1000, собственно означает то же самое. Что за компоненты не установлены - загадка.

Стек вызовов:

   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)

Подскажите пожалуйста, как можно определить каких неустановленных компонентов не хватает?


Ответы (0 шт):