Skip to content

Commit 488a96a

Browse files
Copilotnlogozzo
andauthored
Fix NativeAOT NullReferenceException in GNOME views (#120)
* Initial plan * Fix NativeAOT NullReferenceException in GNOME views by preserving non-public fields for reflection Co-authored-by: nlogozzo <17648453+nlogozzo@users.noreply.github.com> Agent-Logs-Url: https://github.com/NickvisionApps/Application/sessions/236a2817-ce25-4a8f-813a-5f89c86b0623 --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: nlogozzo <17648453+nlogozzo@users.noreply.github.com>
1 parent 5c93534 commit 488a96a

2 files changed

Lines changed: 4 additions & 0 deletions

File tree

Nickvision.Application.GNOME/Views/MainWindow.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
using Nickvision.Desktop.GNOME.Helpers;
1111
using Nickvision.Desktop.Notifications;
1212
using System;
13+
using System.Diagnostics.CodeAnalysis;
1314
using System.Linq;
1415

1516
namespace Nickvision.Application.GNOME.Views;
@@ -43,6 +44,7 @@ public MainWindow(IServiceProvider serviceProvider, MainWindowController control
4344

4445
}
4546

47+
[DynamicDependency(DynamicallyAccessedMemberTypes.NonPublicFields, typeof(MainWindow))]
4648
private MainWindow(IServiceProvider serviceProvider, MainWindowController controller, AppInfo appInfo, IEventsService eventsService, ITranslationService translationService, Gtk.Builder builder) : base(new Adw.Internal.ApplicationWindowHandle(builder.GetPointer("root"), false))
4749
{
4850
var application = serviceProvider.GetRequiredService<Adw.Application>();

Nickvision.Application.GNOME/Views/PreferencesDialog.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
using Nickvision.Application.Shared.Models;
33
using Nickvision.Desktop.GNOME.Helpers;
44
using System;
5+
using System.Diagnostics.CodeAnalysis;
56

67
namespace Nickvision.Application.GNOME.Views;
78

@@ -20,6 +21,7 @@ public PreferencesDialog(PreferencesViewController controller, IGtkBuilderFactor
2021

2122
}
2223

24+
[DynamicDependency(DynamicallyAccessedMemberTypes.NonPublicFields, typeof(PreferencesDialog))]
2325
private PreferencesDialog(PreferencesViewController controller, Gtk.Builder builder) : base(new Adw.Internal.PreferencesDialogHandle(builder.GetPointer("root"), false))
2426
{
2527
_controller = controller;

0 commit comments

Comments
 (0)