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

Fix AOT incompatible code #7534

Merged
merged 2 commits into from
Feb 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Avalonia.X11/NativeDialogs/Gtk.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public void Dispose()
public static IDisposable ConnectSignal<T>(IntPtr obj, string name, T handler)
{
var handle = GCHandle.Alloc(handler);
var ptr = Marshal.GetFunctionPointerForDelegate((Delegate)(object)handler);
var ptr = Marshal.GetFunctionPointerForDelegate<T>(handler);
using (var utf = new Utf8Buffer(name))
{
var id = g_signal_connect_object(obj, utf, ptr, IntPtr.Zero, 0);
Expand Down
6 changes: 3 additions & 3 deletions src/Windows/Avalonia.Win32/Interop/UnmanagedMethods.cs
Original file line number Diff line number Diff line change
Expand Up @@ -862,7 +862,7 @@ public struct BITMAPINFOHEADER

public void Init()
{
biSize = (uint)Marshal.SizeOf(this);
biSize = (uint)sizeof(BITMAPINFOHEADER);
}
}

Expand Down Expand Up @@ -1521,7 +1521,7 @@ internal struct RTL_OSVERSIONINFOEX
internal static Version RtlGetVersion()
{
RTL_OSVERSIONINFOEX v = new RTL_OSVERSIONINFOEX();
v.dwOSVersionInfoSize = (uint)Marshal.SizeOf(v);
v.dwOSVersionInfoSize = (uint)Marshal.SizeOf<RTL_OSVERSIONINFOEX>();
if (RtlGetVersion(ref v) == 0)
{
return new Version((int)v.dwMajorVersion, (int)v.dwMinorVersion, (int)v.dwBuildNumber);
Expand Down Expand Up @@ -1914,7 +1914,7 @@ public static WINDOWPLACEMENT Default
get
{
WINDOWPLACEMENT result = new WINDOWPLACEMENT();
result.Length = Marshal.SizeOf(result);
result.Length = Marshal.SizeOf<WINDOWPLACEMENT>();
return result;
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/Windows/Avalonia.Win32/WindowImpl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ public Size? FrameSize
return new Size(rcWindow.Width, rcWindow.Height) / RenderScaling;
}

DwmGetWindowAttribute(_hwnd, (int)DwmWindowAttribute.DWMWA_EXTENDED_FRAME_BOUNDS, out var rect, Marshal.SizeOf(typeof(RECT)));
DwmGetWindowAttribute(_hwnd, (int)DwmWindowAttribute.DWMWA_EXTENDED_FRAME_BOUNDS, out var rect, Marshal.SizeOf<RECT>());
return new Size(rect.Width, rect.Height) / RenderScaling;
}
}
Expand Down Expand Up @@ -337,7 +337,7 @@ private WindowTransparencyLevel Win7EnableBlur(WindowTransparencyLevel transpare
private WindowTransparencyLevel Win8xEnableBlur(WindowTransparencyLevel transparencyLevel)
{
var accent = new AccentPolicy();
var accentStructSize = Marshal.SizeOf(accent);
var accentStructSize = Marshal.SizeOf<AccentPolicy>();

if (transparencyLevel == WindowTransparencyLevel.AcrylicBlur)
{
Expand Down Expand Up @@ -392,7 +392,7 @@ private WindowTransparencyLevel Win10EnableBlur(WindowTransparencyLevel transpar
bool canUseAcrylic = Win32Platform.WindowsVersion.Major > 10 || Win32Platform.WindowsVersion.Build >= 19628;

var accent = new AccentPolicy();
var accentStructSize = Marshal.SizeOf(accent);
var accentStructSize = Marshal.SizeOf<AccentPolicy>();

if (transparencyLevel == WindowTransparencyLevel.AcrylicBlur && !canUseAcrylic)
{
Expand Down