Page 1 of 1

OD keeps crashing when loading ApptBook

Posted: Sat Aug 12, 2023 5:37 pm
by wjstarck
OD keeps crashing right here (arrow):

Code: Select all

		protected override void OnPaint(PaintEventArgs e) {
			base.OnPaint(e);
			Graphics graphics=e.Graphics;
			graphics.SmoothingMode=SmoothingMode.HighQuality;
			Rectangle rectangleOnControl;//the rectangle of the entire area under consideration. We cycle through subsections of the control.
			Rectangle rectangleClip;//frequently smaller than e.ClipRectangle. 
			Rectangle rectangleSource;//source within the bitmap we are pulling from
			float widthProvs;
			if(_showProvBars){
				widthProvs=_widthProv*_listProvsVisible.Count;
			}
			else{
				widthProvs=0;
			}
			//main area
			if(_bitmapMain!=null){
				rectangleOnControl=new Rectangle(Round(_widthTime+widthProvs),Round(_heightProvOpHeaders),_widthMainVisible,_heightMainVisible);
				if(rectangleOnControl.IntersectsWith(e.ClipRectangle)){
					//We don't want to redraw the entire image.  If we are dragging a small appt across this, we only want to redraw a small rect.
					rectangleClip=Rectangle.Intersect(rectangleOnControl,e.ClipRectangle);
					rectangleSource=new Rectangle(rectangleClip.X-Round(_widthTime+widthProvs)+hScrollBar1.Value,
						rectangleClip.Y-Round(_heightProvOpHeaders)+vScrollBar1.Value,
						rectangleClip.Width,rectangleClip.Height);
					graphics.DrawImage(_bitmapMain,rectangleClip,rectangleSource,GraphicsUnit.Pixel); <-------------------------------------
				}
			}
It's happening virtually every time I launch OD in the debugger.

Here is the exception:

Code: Select all

System.OutOfMemoryException
  HResult=0x8007000E
  Message=Out of memory.
  Source=System.Drawing
  StackTrace:
   at System.Drawing.Graphics.CheckErrorStatus(Int32 status)
   at System.Drawing.Graphics.DrawImage(Image image, Rectangle destRect, Rectangle srcRect, GraphicsUnit srcUnit)
   at OpenDental.UI.ControlApptPanel.OnPaint(PaintEventArgs e) in C:\Users\wjs\Desktop\ODVersions\EASyMT_23.1\opendental23.1\OpenDental\UI\Appt\ControlApptPanel.cs:line 1304
   at System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e, Int16 layer)
   at System.Windows.Forms.Control.WmPaint(Message& m)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
   at System.Windows.Forms.ContainerControl.WndProc(Message& m)
   at System.Windows.Forms.UserControl.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.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

  This exception was originally thrown at this call stack:
    [External Code]
    OpenDental.UI.ControlApptPanel.OnPaint(System.Windows.Forms.PaintEventArgs) in ControlApptPanel.cs
    [External Code]
Although sometimes it will say 'the parameter is null' or 'the parameter is not valid.'

Sometimes if I clean the solution or reboot it'll go away for awhile. I've tried in VS2019 and 2022.

Any idea why? it's happening in both the latest 23.1.x and 23.2.x builds. I'm on a largish display (34" LG) - my resolution is 3440 x 1440 if that matters.

Here is the 'Parameter not valid' exception:

Code: Select all

System.ArgumentException
  HResult=0x80070057
  Message=Parameter is not valid.
  Source=System.Drawing
  StackTrace:
   at System.Drawing.Bitmap..ctor(Int32 width, Int32 height, PixelFormat format)
   at System.Drawing.Bitmap..ctor(Int32 width, Int32 height)
   at OpenDental.UI.ControlApptPanel.SetBitmapMain(Graphics gPrinting) in C:\Users\wjs\Desktop\ODVersions\EASy_23.2\OpenDental23.2\OpenDental\UI\Appt\ControlApptPanel.cs:line 2327
   at OpenDental.UI.ControlApptPanel.RedrawAsNeeded() in C:\Users\wjs\Desktop\ODVersions\EASy_23.2\OpenDental23.2\OpenDental\UI\Appt\ControlApptPanel.cs:line 1839
   at OpenDental.UI.ControlApptPanel.set_IsWeeklyView(Boolean value) in C:\Users\wjs\Desktop\ODVersions\EASy_23.2\OpenDental23.2\OpenDental\UI\Appt\ControlApptPanel.cs:line 593
   at OpenDental.ControlAppt.SetWeeklyView(Boolean isWeeklyView, Boolean skipModuleSelection) in C:\Users\wjs\Desktop\ODVersions\EASy_23.2\OpenDental23.2\OpenDental\Main Modules\ControlAppt.cs:line 4965
   at OpenDental.ControlAppt.InitializeOnStartup() in C:\Users\wjs\Desktop\ODVersions\EASy_23.2\OpenDental23.2\OpenDental\Main Modules\ControlAppt.cs:line 2859
   at OpenDental.FormOpenDental.SetModuleSelected(Boolean menuBarClicked) in C:\Users\wjs\Desktop\ODVersions\EASy_23.2\OpenDental23.2\OpenDental\Main Modules\FormOpenDental.cs:line 4048
   at OpenDental.FormOpenDental.SetModuleSelected() in C:\Users\wjs\Desktop\ODVersions\EASy_23.2\OpenDental23.2\OpenDental\Main Modules\FormOpenDental.cs:line 4041
   at OpenDental.FormOpenDental.ProcessCommandLine() in C:\Users\wjs\Desktop\ODVersions\EASy_23.2\OpenDental23.2\OpenDental\Main Modules\FormOpenDental.cs:line 1193
   at OpenDental.FormOpenDental.FormOpenDentalShown() in C:\Users\wjs\Desktop\ODVersions\EASy_23.2\OpenDental23.2\OpenDental\Main Modules\FormOpenDental.cs:line 813
   at OpenDental.FormOpenDental.FormOpenDental_Shown(Object sender, EventArgs e) in C:\Users\wjs\Desktop\ODVersions\EASy_23.2\OpenDental23.2\OpenDental\Main Modules\FormOpenDental.cs:line 385
   at System.EventHandler.Invoke(Object sender, EventArgs e)
   at System.Windows.Forms.Form.OnShown(EventArgs e)
   at System.Windows.Forms.Form.CallShownEvent()
   at System.Windows.Forms.Control.InvokeMarshaledCallbackDo(ThreadMethodEntry tme)
   at System.Windows.Forms.Control.InvokeMarshaledCallbackHelper(Object obj)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) in f:\dd\ndp\clr\src\BCL\system\threading\executioncontext.cs:line 980
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) in f:\dd\ndp\clr\src\BCL\system\threading\executioncontext.cs:line 927
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) in f:\dd\ndp\clr\src\BCL\system\threading\executioncontext.cs:line 916
   at System.Windows.Forms.Control.InvokeMarshaledCallback(ThreadMethodEntry tme)
   at System.Windows.Forms.Control.InvokeMarshaledCallbacks()
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
   at System.Windows.Forms.Form.WndProc(Message& m)
   at OpenDental.FormODBase.WndProc(Message& m) in C:\Users\wjs\Desktop\ODVersions\EASy_23.2\OpenDental23.2\OpenDental\UI\BordersDpi\FormODBase.cs:line 1609
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
   at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
   at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
   at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
   at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
   at System.Windows.Forms.Application.Run(Form mainForm)
   at OpenDental.ProgramEntry.Main(String[] args) in C:\Users\wjs\Desktop\ODVersions\EASy_23.2\OpenDental23.2\OpenDental\Main Modules\ProgramEntry.cs:line 143

Re: OD keeps crashing when loading ApptBook

Posted: Sun Aug 13, 2023 4:26 pm
by wjstarck
FYI, if I turn the monitor's resolution down to 1920 x 1080 the problem goes away.

Re: OD keeps crashing when loading ApptBook

Posted: Fri Aug 18, 2023 11:30 am
by jsalmon
My monitor can do some pretty outlandish resolutions (e.g. 3840 x 2160) so I'll play around with them and see if I can duplicate your errors. What kind of cable does your monitor use? Is it HDMI?
Mine is a DisplayPort cable which then goes through a converter into a mini DisplayPort plug.

Re: OD keeps crashing when loading ApptBook

Posted: Fri Aug 18, 2023 1:42 pm
by wjstarck
Hi Jason-

it's HDMI.

Re: OD keeps crashing when loading ApptBook

Posted: Mon Aug 21, 2023 12:10 pm
by jsalmon
I am unable to duplicate this on my machine but will forward this information to our testing department to see if they have better luck.

Re: OD keeps crashing when loading ApptBook

Posted: Thu Aug 24, 2023 12:03 pm
by jsalmon
Our testing department was not able to duplicate this as well. The only thing I can think of to do is start hammering you with questions:
1. What OS is being used?
2. What graphics card is being used?
3. What graphics drivers are currently installed? (a lot of times the drivers are old)
4. Is the OS doing any scaling?
5. Is the Open Dental Zoom feature being used?
6. Are any of the 'No...txt' files being used?
^E.g. NoDpi.txt