5.4.19 - clicking on an appointment in the agenda crashes OD

This forum is for programmers who have questions about the source code.
Post Reply
Mifa
Posts: 141
Joined: Wed Nov 21, 2007 6:52 pm
Location: Saint-Bruno, QC, Canada
Contact:

5.4.19 - clicking on an appointment in the agenda crashes OD

Post by Mifa » Thu Dec 27, 2007 3:46 pm

I've just downloaded and built 5.4.19 and cannot get it to run. I'm getting an exception 'cannot convert System.SByte to System.Byte' that makes OD crash whenever I click on an appointment in the agenda. Using the debugger, it stops on line 204, in dataObjectFactory.cs. Just to be sure, I've downloaded 5.3, build it, and it works just fine.

Here is the full error message:

System.ArgumentException was unhandled
Message="Object of type 'System.SByte' cannot be converted to type 'System.Byte'."
Source="mscorlib"
StackTrace:
at System.RuntimeType.CheckValue(Object value, Binder binder, CultureInfo culture, BindingFlags invokeAttr)
at System.Reflection.RtFieldInfo.InternalSetValue(Object obj, Object value, BindingFlags invokeAttr, Binder binder, CultureInfo culture, Boolean doVisibilityCheck, Boolean doCheckConsistency)
at System.Reflection.RtFieldInfo.SetValue(Object obj, Object value, BindingFlags invokeAttr, Binder binder, CultureInfo culture)
at System.Reflection.FieldInfo.SetValue(Object obj, Object value)
at OpenDental.DataAccess.DataObjectFactory`1.CreateObject(IDataReader reader) in C:\Documents and Settings\mfabre\Desktop\ODSource 5.4.x\OpenDentBusiness\DataAccess\DataObjectFactory.cs:line 204
at OpenDental.DataAccess.DataObjectFactory`1.CreateObjects(IDataReader reader) in C:\Documents and Settings\mfabre\Desktop\ODSource 5.4.x\OpenDentBusiness\DataAccess\DataObjectFactory.cs:line 358
at OpenDental.DataAccess.DataObjectFactory`1.CreateObjects(String query) in C:\Documents and Settings\mfabre\Desktop\ODSource 5.4.x\OpenDentBusiness\DataAccess\DataObjectFactory.cs:line 55
at OpenDental.Patients.SubmitAndFill(String command) in C:\Documents and Settings\mfabre\Desktop\ODSource 5.4.x\OpenDental\Data Interface\Patients.cs:line 61
at OpenDental.Patients.GetPat(Int32 patNum) in C:\Documents and Settings\mfabre\Desktop\ODSource 5.4.x\OpenDental\Data Interface\Patients.cs:line 57
at OpenDental.ContrAppt.RefreshModulePatient(Int32 patNum) in C:\Documents and Settings\mfabre\Desktop\ODSource 5.4.x\OpenDental\Main Modules\ContrAppt.cs:line 1101
at OpenDental.ContrAppt.ContrApptSheet2_MouseDown(Object sender, MouseEventArgs e) in C:\Documents and Settings\mfabre\Desktop\ODSource 5.4.x\OpenDental\Main Modules\ContrAppt.cs:line 2010
at System.Windows.Forms.Control.OnMouseDown(MouseEventArgs e)
at System.Windows.Forms.UserControl.OnMouseDown(MouseEventArgs e)
at System.Windows.Forms.Control.WmMouseDown(Message& m, MouseButtons button, Int32 clicks)
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)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 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.FormOpenDental.Main() in C:\Documents and Settings\mfabre\Desktop\ODSource 5.4.x\OpenDental\Main Modules\FormOpenDental.cs:line 1183
at System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()

Mifa
Posts: 141
Joined: Wed Nov 21, 2007 6:52 pm
Location: Saint-Bruno, QC, Canada
Contact:

Post by Mifa » Sun Jan 06, 2008 9:15 am

Since it seems I'm the only one having this problem, it must be a data problem, which is kind of unsettling since I'm using a backup of our live database that works fine with 4.6 in production and 5.3 in test.

To be more specific about the error, it happens whenever I try to access directly or indirectly patient information. The database field that causes the unhandled exception is SchedDayOfWeek (ord=63), which we don't use and is set to 0 for all the patients in the database.

What's even more unsettling, is that when I copy all the records from my patient table and paste them in the demo database, everything works fine...

Help :cry:

User avatar
Justin Shafer
Posts: 596
Joined: Sat Jul 28, 2007 7:34 pm
Location: Fort Worth, TX.

Post by Justin Shafer » Sun Jan 06, 2008 10:47 am

Have you used MySQL Admin to backup up your database and then restore it? I believe mysql admin can be used to check for problems with the database...

If you take a trial database and put it as the database then no problems??? And if you take your patient table and paste it into this database still no problems????

I would say to try to backup and restore the database to see if that helps any errors... but be sure to backup the actual database when mysql is closed so you dont loose any data.

Perhaps it is a data issue... Jordan will know more...

Mysql-Admin is downloadable... http://dev.mysql.com/downloads/gui-tools/5.0.html

Mifa
Posts: 141
Joined: Wed Nov 21, 2007 6:52 pm
Location: Saint-Bruno, QC, Canada
Contact:

Post by Mifa » Sun Jan 06, 2008 10:58 am

I didn't use MySQL Admin. I'll follow your advise and see if it solves the problem.

Thanks for replying!

User avatar
jordansparks
Site Admin
Posts: 5739
Joined: Sun Jun 17, 2007 3:59 pm
Location: Salem, Oregon
Contact:

Post by jordansparks » Sun Jan 06, 2008 12:51 pm

I was on vacation when this was initially posted. I'll be reviewing it today and post updates here. I suspect it has something to do with you being in Quebec.
Jordan Sparks, DMD
http://www.opendental.com

Mifa
Posts: 141
Joined: Wed Nov 21, 2007 6:52 pm
Location: Saint-Bruno, QC, Canada
Contact:

Post by Mifa » Mon Jan 07, 2008 7:30 pm

Justin, Jordan,

I've tried using MySQL admin. Backup and restore were successful (I even restored under a new name). No errors detected. The restored database works fine in 4.6 but, when converted to 5.4 leads to the same problem. I've even tried a 2 step conversion first from 4.6 to 5.3 (which works fine for me), then from 5.3 to 5.4: same difference!

There's a quick and dirty workaround that I have tried tonight. I don't like it at all, but it has allowed me to continue testing 5.4: it consists in adding a try... catch... for typeof Byte in CreateObject(), using Byte.MinValue as the catch-all value. This is just a way for me to avoid the painful exception, it's not a valid solution I believe...

User avatar
jordansparks
Site Admin
Posts: 5739
Joined: Sun Jun 17, 2007 3:59 pm
Location: Salem, Oregon
Contact:

Post by jordansparks » Tue Jan 08, 2008 2:07 pm

I was able to duplicate it by changing the definition of one of the tables in the mysql database. But how your database got into that state is another matter. I will post more shortly.
Jordan Sparks, DMD
http://www.opendental.com

User avatar
jordansparks
Site Admin
Posts: 5739
Joined: Sun Jun 17, 2007 3:59 pm
Location: Salem, Oregon
Contact:

Post by jordansparks » Tue Jan 08, 2008 4:59 pm

This query will fix it:
ALTER TABLE patient CHANGE SchedDayOfWeek SchedDayOfWeek tinyint unsigned NOT NULL

There is nothing that we did that could have changed the definition of that column in your database. Something happened on your end that is entirely unique. No other user will have this problem. Maybe your harddrive was hit by a cosmic ray, who knows?
Jordan Sparks, DMD
http://www.opendental.com

Mifa
Posts: 141
Joined: Wed Nov 21, 2007 6:52 pm
Location: Saint-Bruno, QC, Canada
Contact:

Post by Mifa » Tue Jan 08, 2008 8:18 pm

Wow! Amazing... It works!!! From now on, I'll put the server in a dark room with lead walls to keep it away from these nasty cosmic rays :lol:

Thanks a lot!

JSLifesmiles
Posts: 5
Joined: Wed Feb 13, 2008 11:51 am

same problem

Post by JSLifesmiles » Sun Mar 02, 2008 12:37 pm

I'm having the same problem and I already posted it under advanced... here is the terminal output again:

Unhandled Exception: System.InvalidCastException: Unknown target convertion type from System.Byte to OpenDentBusiness.PatientStatus
at System.Convert.ToType (System.Object value, System.Type conversionType, IFormatProvider provider) [0x00000]
at System.Convert.ChangeType (System.Object value, System.Type conversionType) [0x00000]
at System.Reflection.Binder+Default.ChangeType (System.Object value, System.Type type, System.Globalization.CultureInfo culture) [0x00000]
at System.Reflection.MonoField.SetValue (System.Object obj, System.Object val, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Globalization.CultureInfo culture) [0x00000]
at System.Reflection.FieldInfo.SetValue (System.Object obj, System.Object value) [0x00000]
at OpenDental.DataAccess.DataObjectFactory`1[OpenDentBusiness.Patient].CreateObject (IDataReader ) [0x00000]
at OpenDental.DataAccess.DataObjectFactory`1[OpenDentBusiness.Patient].CreateObjects (IDataReader ) [0x00000]
at OpenDental.DataAccess.DataObjectFactory`1[OpenDentBusiness.Patient].CreateObjects (System.String ) [0x00000]
at OpenDental.Patients.SubmitAndFill (System.String command) [0x00000]
at OpenDental.Patients.GetPat (Int32 patNum) [0x00000]
at OpenDental.ContrAppt.RefreshModulePatient (Int32 patNum) [0x00000]
at OpenDental.ContrAppt.ContrApptSheet2_MouseDown (System.Object sender, System.Windows.Forms.MouseEventArgs e) [0x00000]
at System.Windows.Forms.Control.OnMouseDown (System.Windows.Forms.MouseEventArgs e) [0x00000]
at System.Windows.Forms.UserControl.OnMouseDown (System.Windows.Forms.MouseEventArgs e) [0x00000]
at System.Windows.Forms.Control.WmLButtonDown (System.Windows.Forms.Message& m) [0x00000]
at System.Windows.Forms.Control.WndProc (System.Windows.Forms.Message& m) [0x00000]
at System.Windows.Forms.ScrollableControl.WndProc (System.Windows.Forms.Message& m) [0x00000]
at System.Windows.Forms.ContainerControl.WndProc (System.Windows.Forms.Message& m) [0x00000]
at System.Windows.Forms.UserControl.WndProc (System.Windows.Forms.Message& m) [0x00000]
at System.Windows.Forms.Control+ControlWindowTarget.OnMessage (System.Windows.Forms.Message& m) [0x00000]
at System.Windows.Forms.Control+ControlNativeWindow.WndProc (System.Windows.Forms.Message& m) [0x00000]
at System.Windows.Forms.NativeWindow.WndProc (IntPtr hWnd, Msg msg, IntPtr wParam, IntPtr lParam) [0x00000]
at System.Windows.Forms.XplatUIX11.DispatchMessage (System.Windows.Forms.MSG& msg) [0x00000]
at System.Windows.Forms.XplatUI.DispatchMessage (System.Windows.Forms.MSG& msg) [0x00000]
at System.Windows.Forms.Application.RunLoop (Boolean Modal, System.Windows.Forms.ApplicationContext context) [0x00000]
at System.Windows.Forms.Application.Run (System.Windows.Forms.ApplicationContext context) [0x00000]
at System.Windows.Forms.Application.Run (System.Windows.Forms.Form mainForm) [0x00000]
at OpenDental.FormOpenDental.Main () [0x00000]


I tried the fix mentioned in this post and it was applied, but did not fix the crashing.

Thanks for all the help guys!

User avatar
jordansparks
Site Admin
Posts: 5739
Joined: Sun Jun 17, 2007 3:59 pm
Location: Salem, Oregon
Contact:

Post by jordansparks » Sun Mar 02, 2008 9:20 pm

It's a different problem. Look at the errors. Yours is an error converting a Byte to a PatientStatus enum. The other error message was when converting a SByte to a Byte. Totally different. Anyway...

It's because you're trying to run it on Linux. I just sent an email to Derek. He should reply with the specific version of Mono we tested it on. Then, we'll update the Linux page on our website.
Jordan Sparks, DMD
http://www.opendental.com

JSLifesmiles
Posts: 5
Joined: Wed Feb 13, 2008 11:51 am

Thanks

Post by JSLifesmiles » Mon Mar 03, 2008 6:49 am

Yes, you are correct, sorry it just looked similar at first glance. I am going to post the same error code on mono's forum as well and see if I can get them to tackle it.

I know that Mono 1.2.4 doesn't work, and that 1.2.6 doesn't seem to be working either so I guess I'll try 1.2.5 next *chuckles*

User avatar
jordansparks
Site Admin
Posts: 5739
Joined: Sun Jun 17, 2007 3:59 pm
Location: Salem, Oregon
Contact:

Post by jordansparks » Mon Mar 03, 2008 6:51 am

Don't bother the poor Mono folks. It's up to us.
Jordan Sparks, DMD
http://www.opendental.com

JSLifesmiles
Posts: 5
Joined: Wed Feb 13, 2008 11:51 am

Fixed

Post by JSLifesmiles » Wed Mar 05, 2008 5:25 pm

This has been fixed in OD version 5.6. I just downloaded the beta and tested it and the problem no longer exists! Thank you Jordan and everyone who's been working on it!

JSLifeSmiles

Post Reply