question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Make MONITORINFO a struct

See original GitHub issue

This is possible fix for exception thrown when using CoreRT.

Feedback from CoreRT chatroom :

“Btw, you can work around the GetMonitorInfo trouble by making MONITORINFO a struct and passing it either as a pointer or a ref to the GetMonitorInfo method. The compiler can’t generate marshaling for classes currently”

https://github.com/AvaloniaUI/Avalonia/blob/a0331b98896bffa09f02b0db999527fdf0fe2481/src/Windows/Avalonia.Win32/Interop/UnmanagedMethods.cs#L1058

Error when using WindowStartupLocation:

Unhandled Exception: System.Exception: Method '[Avalonia.Win32]Avalonia.Win32.Interop.UnmanagedMethods.GetMonitorInfo(native int,MONITORINFO)' requires non-trivial marshalling that is not yet supported by this compiler.
   at Avalonia.Win32.Interop.UnmanagedMethods.GetMonitorInfo(IntPtr, UnmanagedMethods.MONITORINFO) + 0x23
   at Avalonia.Win32.ScreenImpl.<>c__DisplayClass4_0.<get_AllScreens>b__0(IntPtr, IntPtr, Rect&, IntPtr) + 0x82
   at Core2D.Avalonia!<BaseAddress>+0x1475a4b

Error when using menus:

Unhandled Exception: System.Exception: Method '[Avalonia.Win32]Avalonia.Win32.Interop.UnmanagedMethods.GetMonitorInfo(native int,MONITORINFO)' requires non-trivial marshalling that is not yet supported by this compiler.
   at Avalonia.Win32.Interop.UnmanagedMethods.GetMonitorInfo(IntPtr, UnmanagedMethods.MONITORINFO) + 0x23
   at Avalonia.Win32.ScreenImpl.<>c__DisplayClass4_0.<get_AllScreens>b__0(IntPtr, IntPtr, Rect&, IntPtr) + 0x82
   at Core2D.Avalonia!<BaseAddress>+0x1475a4b

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

2reactions
danwalmsleycommented, Sep 29, 2018

Avalonia native could probably just supply the monitor info stuff and like you say accessibility. Just where managed code cant be used for whatever reason.

1reaction
kekekekscommented, Sep 30, 2018

Avalonia.Native is meant for platforms where it’s too hard to properly interop with the native code. Cocoa and Qt are good examples. In case of Win32/GTK/X11 and even Wayland it would be easier to maintain managed code base, since they use plain C API.

Read more comments on GitHub >

github_iconTop Results From Across the Web

MONITORINFO structure (winuser.h) - Win32 apps
The MONITORINFO structure is a subset of the MONITORINFOEX structure. The MONITORINFOEX structure adds a string member to contain a name for the ......
Read more >
Windows API MONITORINFO Structure - c++
If you want to walk the monitor structures, you should use the EnumDisplayMonitors function, and an appropriate callback routine.
Read more >
MONITORINFO (user32)
The MONITORINFOEX structure contains information about a display monitor. The GetMonitorInfo function stores information into a ...
Read more >
Struct MonitorInfoEx | Dapplo.Windows
A string that specifies the device name of the monitor being used. Most applications have no use for a display monitor name, and...
Read more >
C++ : Windows API MONITORINFO Structure
C++ : Windows API MONITORINFO Structure To Access My Live Chat Page, On Google, Search for "hows ... First, Make sure the video...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found