Skip to content

feat: NativeAOT#116

Merged
nlogozzo merged 8 commits intomainfrom
feat/aot
Mar 21, 2026
Merged

feat: NativeAOT#116
nlogozzo merged 8 commits intomainfrom
feat/aot

Conversation

@nlogozzo
Copy link
Copy Markdown
Member

No description provided.

nlogozzo and others added 3 commits March 20, 2026 09:45
* Initial plan

* Fix IL3050 NativeAOT warnings by adding RequiresDynamicCode attribute to Main methods

Co-authored-by: nlogozzo <17648453+nlogozzo@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: nlogozzo <17648453+nlogozzo@users.noreply.github.com>
@nlogozzo
Copy link
Copy Markdown
Member Author

@copilot This WinUI settingspage is crashing when i open it in NativeAOT compiled app. I'm seeing these warning in compiler:

Severity	Code	Description	Project	File	Line	Suppression State	Details
Warning (active)	WMC1510	Ensure the property path is trimming and AOT compatible by making use of 'Compiled Bindings (x:bind)' if possible or by specifying the 'x:DataType' directive with the respective binding data context and marking the type declaration with the 'WinRT.GeneratedBindableCustomProperty' attribute or the 'Microsoft.UI.Xaml.Data.Bindable' attribute. If you are unable to do either but can ensure the data type is attributed correctly, then you can also suppress the warning by specifying `x:SuppressXamlTrimWarnings=True` within the closest element. If not, the property path might be trimmed and will not be AOT compatible.	Nickvision.Application.WinUI	C:\Users\nlogozzo\OneDrive\Documents\Programming\Application\Nickvision.Application.WinUI\Views\SettingsPage.xaml	50		
Severity	Code	Description	Project	File	Line	Suppression State	Details
Warning (active)	WMC1510	Ensure the property path is trimming and AOT compatible by making use of 'Compiled Bindings (x:bind)' if possible or by specifying the 'x:DataType' directive with the respective binding data context and marking the type declaration with the 'WinRT.GeneratedBindableCustomProperty' attribute or the 'Microsoft.UI.Xaml.Data.Bindable' attribute. If you are unable to do either but can ensure the data type is attributed correctly, then you can also suppress the warning by specifying `x:SuppressXamlTrimWarnings=True` within the closest element. If not, the property path might be trimmed and will not be AOT compatible.	Nickvision.Application.WinUI	C:\Users\nlogozzo\OneDrive\Documents\Programming\Application\Nickvision.Application.WinUI\Views\SettingsPage.xaml	58		

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 20, 2026

@nlogozzo I've opened a new pull request, #117, to work on those changes. Once the pull request is ready, I'll request review from you.

Copilot AI and others added 2 commits March 20, 2026 13:06
…ge (#117)

* Initial plan

* fix: replace DisplayMemberPath with compiled x:Bind ItemTemplate for NativeAOT compatibility

Co-authored-by: nlogozzo <17648453+nlogozzo@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: nlogozzo <17648453+nlogozzo@users.noreply.github.com>
@nlogozzo
Copy link
Copy Markdown
Member Author

@copilot After your change I merged, I'm seeing System.ArgumentException: 'Value does not fall within the expected range.' now on line 28 of SettingsPage.xaml.cs when running the build now on WinUI

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 20, 2026

@nlogozzo I've opened a new pull request, #118, to work on those changes. Once the pull request is ready, I'll request review from you.

@nlogozzo
Copy link
Copy Markdown
Member Author

@copilot Still seeing:

System.ArgumentException
  HResult=0x80070057
  Message=Value does not fall within the expected range.
  Source=<Cannot evaluate the exception source>
  StackTrace:
<Cannot evaluate the exception stack trace>

on line 28 in SettingsPage.xaml.cs.

This is what is being used:

using Nickvision.Desktop.Application;
using WinRT;

namespace Nickvision.Desktop.WinUI.Helpers;

[GeneratedBindableCustomProperty]
public sealed partial class BindableSelectionItem
{
    private readonly ISelectionItem _selectionItem;

    public BindableSelectionItem(ISelectionItem selectionItem)
    {
        _selectionItem = selectionItem;
    }

    public string Label => _selectionItem.Label;

    public bool ShouldSelect
    {
        get => _selectionItem.ShouldSelect;

        set => _selectionItem.ShouldSelect = value;
    }

    public static implicit operator BindableSelectionItem(SelectionItem<object> item) => new BindableSelectionItem(item);
}

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 20, 2026

@nlogozzo I've opened a new pull request, #119, to work on those changes. Once the pull request is ready, I'll request review from you.

@nlogozzo nlogozzo merged commit 534638d into main Mar 21, 2026
2 checks passed
@nlogozzo nlogozzo deleted the feat/aot branch March 21, 2026 15:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants