Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show Dialog crash in NativeAOT #7533

Closed
kant2002 opened this issue Feb 5, 2022 · 1 comment · Fixed by #7534
Closed

Show Dialog crash in NativeAOT #7533

kant2002 opened this issue Feb 5, 2022 · 1 comment · Fixed by #7534
Labels

Comments

@kant2002
Copy link
Contributor

kant2002 commented Feb 5, 2022

Describe the bug
After compiling KirillOsenkov/MSBuildStructuredLog#564
When pressing Open File Dialog crash with

Unhandled Exception: EETypeRva:0x07F1B9A0(System.Runtime.InteropServices.MissingInteropDataException): Avalonia.X11.NativeDialogs.Gtk+signal_generic is missing delegate marshalling data. To enable delegate marshalling data, add a MarshalDelegate directive to the application rd.xml file. For more information, please visit http://go.microsoft.com/fwlink/?LinkID=393965
   at Internal.Runtime.CompilerHelpers.RuntimeInteropData.GetDelegateMarshallingStub(RuntimeTypeHandle, Boolean) + 0x91
   at System.Runtime.InteropServices.PInvokeMarshal.AllocateThunk(Delegate) + 0x7f
   at System.Runtime.CompilerServices.ConditionalWeakTable`2.GetValueLocked(TKey, ConditionalWeakTable`2.CreateValueCallback) + 0x27
   at System.Runtime.CompilerServices.ConditionalWeakTable`2.GetValue(TKey, ConditionalWeakTable`2.CreateValueCallback) + 0x41
   at System.Runtime.InteropServices.PInvokeMarshal.GetFunctionPointerForDelegate(Delegate) + 0x97
   at Avalonia.X11.NativeDialogs.Glib.ConnectSignal[T](IntPtr, String, T) + 0x5e
   at Avalonia.X11.NativeDialogs.GtkSystemDialog.ShowDialog(String, IWindowImpl, GtkFileChooserAction, Boolean, String, IEnumerable`1, String) + 0x345
   at Avalonia.X11.NativeDialogs.GtkSystemDialog.<>c__DisplayClass3_0.<ShowFileDialogAsync>b__0() + 0x133
   at Avalonia.X11.NativeDialogs.Glib.<>c__DisplayClass15_0`1.<RunOnGlibThread>b__0() + 0x1b

To Reproduce

  1. Clone branch from PR Add publishing configuraiton for NativeAOT KirillOsenkov/MSBuildStructuredLog#564
  2. Run ./PublishNativeAOT.sh
  3. Run bin/StructuredLogViewer.Avalonia/Release/net6.0/linux-x64/publish/StructuredLogViewer.Avalonia
  4. Open File->OpenLog

Expected behavior
I think it should not crash.

Additional context
I did not sure that this is actionable in this repo, except I want this case to be documented, and either I or somebody from community come up with custom rd.xml, or offending code can be rewritten not to crash.

@kant2002 kant2002 added the bug label Feb 5, 2022
@kekekeks
Copy link
Member

kekekeks commented Feb 5, 2022

I guess we might need to add [UnmanagedFunctionPointer] attributes to GTK callback delegates here:

public delegate bool signal_generic(IntPtr gtkWidget, IntPtr userData);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants