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

Exception after opening Options panel 7 times in within the same mRemoteNG instance #1257

Open
kmscode opened this issue Jan 8, 2019 · 2 comments
Assignees
Labels
Bug Something isn't working as expected Medium Priority Ready Verified This issue has been reproduced by a developer and is a verified bug.

Comments

@kmscode
Copy link
Member

kmscode commented Jan 8, 2019

Expected Behavior

Options panel should open every time requested.

Current Behavior

Eventually mRemoteNG will crash with an exception.

Possible Solution

Steps to Reproduce (for bugs)

  1. Open Options Panel
  2. OK or Cancel out of the panel
  3. Repeat 6 or 7 times
  4. mRemoteNG will crash with the following exception:
System.ComponentModel.Win32Exception
  HResult=0x80004005
  Message=Error creating window handle.
  Source=System.Windows.Forms
  StackTrace:
   at System.Windows.Forms.NativeWindow.CreateHandle(CreateParams cp)
   at System.Windows.Forms.Control.CreateHandle()
   at System.Windows.Forms.Form.CreateHandle()
   at System.Windows.Forms.Control.get_Handle()
   at System.Windows.Forms.Form.ShowDialog(IWin32Window owner)
   at mRemoteNG.App.ProgramRoot.ApplicationOnThreadException(Object sender, ThreadExceptionEventArgs e) in C:\Users\skaim\Documents\Source\mRemoteNG\mRemoteV1\App\ProgramRoot.cs:line 86
   at System.Windows.Forms.Application.ThreadContext.OnThreadException(Exception t)
   at System.Windows.Forms.Control.WndProcException(Exception e)
   at System.Windows.Forms.Control.ControlNativeWindow.OnThreadException(Exception e)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

Context

Your Environment

  • Version used: 1.77 - removemagiclib branch
  • Operating System and version (e.g. Windows 10 1709 x64): Win 1809 x64
@kmscode kmscode added Verified This issue has been reproduced by a developer and is a verified bug. Medium Priority Bug Something isn't working as expected Ready labels Jan 8, 2019
@kmscode
Copy link
Member Author

kmscode commented Jan 8, 2019

@jcefoli Opened this issue based on gitter chat.

@jotatsu
Copy link
Contributor

jotatsu commented Jan 22, 2019

I got a more detailed stack trace

at System.Windows.Forms.NativeWindow.CreateHandle(CreateParams cp)
at System.Windows.Forms.Control.CreateHandle()
at System.Windows.Forms.Form.CreateHandle()
at System.Windows.Forms.Control.get_Handle()
at System.Windows.Forms.Control.CreateGraphicsInternal()
at System.Windows.Forms.Control.CreateGraphics()
at mRemoteNG.UI.GraphicsUtilities.GdiPlusGraphicsProvider.GetResolutionScalingFactor() in D:\Open\mRemoteNG\mRemoteV1\UI\GraphicsUtilities\GdiPlusGraphicsProvider.cs:line 16
at mRemoteNG.UI.DisplayProperties.get_ResolutionScalingFactor() in D:\Open\mRemoteNG\mRemoteV1\UI\DisplayProperties.cs:line 14
at mRemoteNG.UI.DisplayProperties.ScaleWidth(Single width) in D:\Open\mRemoteNG\mRemoteV1\UI\DisplayProperties.cs:line 41
at mRemoteNG.UI.Controls.Base.NGCheckBox..ctor() in D:\Open\mRemoteNG\mRemoteV1\UI\Controls\Base\NGCheckBox.cs:line 28
at mRemoteNG.UI.Forms.OptionsPages.NotificationsPage.InitializeComponent() in D:\Open\mRemoteNG\mRemoteV1\UI\Forms\OptionsPages\NotificationsPage.Designer.cs:line 61
at mRemoteNG.UI.Forms.OptionsPages.NotificationsPage..ctor() in D:\Open\mRemoteNG\mRemoteV1\UI\Forms\OptionsPages\NotificationsPage.cs:line 12
at mRemoteNG.UI.Forms.FrmOptions.CompileListOfOptionsPages() in D:\Open\mRemoteNG\mRemoteV1\UI\Forms\FrmOptions.cs:line 65
at mRemoteNG.UI.Forms.FrmOptions.frmOptions_Load(Object sender, EventArgs e) in D:\Open\mRemoteNG\mRemoteV1\UI\Forms\FrmOptions.cs:line 32
at System.Windows.Forms.Form.OnLoad(EventArgs e)
at System.Windows.Forms.Form.OnCreateControl()
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl()
at System.Windows.Forms.Control.WmShowWindow(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.Form.WmShowWindow(Message& m)
at System.Windows.Forms.Form.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

working on this one

jotatsu added a commit that referenced this issue Jan 22, 2019
CreateGraphics was the function being disposed in the using, the form handle was still floating around. Suggestion to optimize the dpi function
@jotatsu jotatsu self-assigned this Jan 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working as expected Medium Priority Ready Verified This issue has been reproduced by a developer and is a verified bug.
Projects
None yet
Development

No branches or pull requests

2 participants