Bluegrams / ScreenRuler

Configurable screen measuring tool for Windows
https://sf.net/p/screenruler
BSD 3-Clause "New" or "Revised" License
233 stars 36 forks source link

App crashes on disconnected screen #58

Closed gravityFlower closed 1 year ago

gravityFlower commented 1 year ago

In an attempt to physically rotate the screen, i accidentally turned the screen off. On turning it on again, i was greeted with following error message:

System.ComponentModel.Win32Exception (0x80004005): Ein an das System angeschlossenes Gerät funktioniert nicht
   bei WindowsDisplayAPI.DisplayConfig.PathDisplayTarget.get_DevicePath()
   bei WindowsDisplayAPI.DisplayConfig.PathDisplayTarget.<ToDisplayDevice>b__40_1(DisplayDevice device)
   bei System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source, Func`2 predicate)
   bei WindowsDisplayAPI.DisplayConfig.PathDisplayTarget.ToDisplayDevice()
   bei ScreenRuler.Configuration.Monitor.MonitorInfo..ctor(PathDisplayTarget pathDisplayTarget)
   bei ScreenRuler.Configuration.Monitor.MonitorInfo.<>c.<GetMonitorInfos>b__14_0(PathDisplayTarget d)
   bei System.Linq.Enumerable.WhereSelectArrayIterator`2.MoveNext()
   bei System.Linq.Buffer`1..ctor(IEnumerable`1 source)
   bei System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
   bei ScreenRuler.Configuration.Monitor.MonitorInfo.GetMonitorInfos()
   bei ScreenRuler.RulerForm.WndProc(Message& m)
   bei System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   bei System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   bei System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

How to reproduce:

  1. Start ruler app
  2. disconnect/turn off screen
  3. connect/turn on screen

More details: I used a two screen setup. The app was running on the screen not turned off, but Windows reconfigured the screens and the error popped up, so i assume the same error will happen with only one monitor.

alxnull commented 1 year ago

Interesting, however, I'm currently unable to reproduce this error with my two-screen setup. Does this always happen if you disconnect/ connect a screen or only under certain circumstances?

gravityFlower commented 1 year ago

I could indeed not reproduce the error. Probably one of those "Have you tried turning your computer off and on again". I now did see the symbol appear in the tray menu on turning the screen off and no crash.