Annoying plugin build problem

This forum is for programmers who have questions about the source code.
Post Reply
User avatar
wjstarck
Posts: 935
Joined: Tue Jul 31, 2007 7:18 am
Location: Keller, TX
Contact:

Annoying plugin build problem

Post by wjstarck » Thu Jul 02, 2020 8:33 am

I've been having an annoying problem when trying to build a plugin project. Probably goes back about a year or so. Occurs every time I try to build my project for a new version of OD.

Procedure:

1) Check out latest of version of OD into a folder and build in VS
2) Switch my plugin folder to a new path in Subversion and update all the plugin properties to match version of OD
3) Open in VS Project Explorer and fix all the broken refs
4) Try to build. VS will generate 600+ errors that all say that OpenDental and OpenDentBusiness cannot be found
5) Double click on each error which opens the .cs file. The using statement will have a squiggly red line underneath either OpenDental or OpenDentbusiness, which then disappears, along with the error
6) Repeat the process for all 600+ errors until no errors show. I can then build my plugin project by right-clicking an selecting 'Build' but if I select 'Rebuild' I am right back to square one.

Cleaning the solution has no effect.

Any ideas?
Cheers,

Bill Starck, DDS
Big Idea Software, LLC
Developer, EASy(Electronic Anesthesia System) for Open Dental
817-807-1709
TX, USA

PatrickC
Posts: 56
Joined: Thu Jun 06, 2019 11:37 am

Re: Annoying plugin build problem

Post by PatrickC » Thu Jul 02, 2020 11:19 am

After doing a rebuild of Opendentbusiness, note where the reference to Opendentbusiness.dll is in your project. Try deleting and readding the reference to Opendentbusiness in your project. You can also try referencing Opendentbusiness as a project and then also as a standalone dll.

Hopefully this will help so that you don't have to click through all your .cs files.
Patrick Carlson
Open Dental Software
http://www.opendental.com

User avatar
wjstarck
Posts: 935
Joined: Tue Jul 31, 2007 7:18 am
Location: Keller, TX
Contact:

Re: Annoying plugin build problem

Post by wjstarck » Thu Jul 02, 2020 11:49 am

Thanks.

Tried that, still get the same result.
Cheers,

Bill Starck, DDS
Big Idea Software, LLC
Developer, EASy(Electronic Anesthesia System) for Open Dental
817-807-1709
TX, USA

User avatar
wjstarck
Posts: 935
Joined: Tue Jul 31, 2007 7:18 am
Location: Keller, TX
Contact:

Re: Annoying plugin build problem

Post by wjstarck » Thu Jul 02, 2020 12:24 pm

Looks like I was targeting the wrong framework in my project (4.5.2 vs 4.7.2)

Thanks
Cheers,

Bill Starck, DDS
Big Idea Software, LLC
Developer, EASy(Electronic Anesthesia System) for Open Dental
817-807-1709
TX, USA

User avatar
wjstarck
Posts: 935
Joined: Tue Jul 31, 2007 7:18 am
Location: Keller, TX
Contact:

Re: Annoying plugin build problem

Post by wjstarck » Thu Jul 02, 2020 12:41 pm

Now I build OK but when I try to run, OD crashes with

Code: Select all

System.ArgumentException
  HResult=0x80070057
  Message=Column 'WirelessPhone' does not belong to table .
  Source=System.Data
  StackTrace:
   at System.Data.DataRow.GetDataColumn(String columnName)
   at System.Data.DataRow.get_Item(String columnName)
   at OpenDentBusiness.Crud.EmployeeCrud.TableToList(DataTable table) in C:\Users\wjs\Desktop\ODVersions\opendental20.2\opendental20.2\OpenDentBusiness\Crud\EmployeeCrud.cs:line 57
   at OpenDentBusiness.Crud.EmployeeCrud.SelectMany(String command) in C:\Users\wjs\Desktop\ODVersions\opendental20.2\opendental20.2\OpenDentBusiness\Crud\EmployeeCrud.cs:line 39
   at OpenDentBusiness.Employees.EmployeeCache.GetCacheFromDb() in C:\Users\wjs\Desktop\ODVersions\opendental20.2\opendental20.2\OpenDentBusiness\Data Interface\Employees.cs:line 81
   at OpenDentBusiness.CacheAbs`1.FillCache(FillCacheSource source, DataTable table) in C:\Users\wjs\Desktop\ODVersions\opendental20.2\opendental20.2\OpenDentBusiness\Cache\CacheAbs.cs:line 36
   at OpenDentBusiness.CacheAbs`1.GetTableFromCache(Boolean doRefreshCache) in C:\Users\wjs\Desktop\ODVersions\opendental20.2\opendental20.2\OpenDentBusiness\Cache\CacheAbs.cs:line 53
   at OpenDentBusiness.Employees.GetTableFromCache(Boolean doRefreshCache) in C:\Users\wjs\Desktop\ODVersions\opendental20.2\opendental20.2\OpenDentBusiness\Data Interface\Employees.cs:line 132
   at OpenDentBusiness.Employees.EmployeeCache.FillCacheIfNeeded() in C:\Users\wjs\Desktop\ODVersions\opendental20.2\opendental20.2\OpenDentBusiness\Data Interface\Employees.cs:line 93
   at OpenDentBusiness.CacheListAbs`1.FillListIfNull() in C:\Users\wjs\Desktop\ODVersions\opendental20.2\opendental20.2\OpenDentBusiness\Cache\CacheListAbs.cs:line 55
   at OpenDentBusiness.CacheListAbs`1.GetDeepCopy(Boolean isShort) in C:\Users\wjs\Desktop\ODVersions\opendental20.2\opendental20.2\OpenDentBusiness\Cache\CacheListAbs.cs:line 79
   at OpenDentBusiness.Employees.GetDeepCopy(Boolean isShort) in C:\Users\wjs\Desktop\ODVersions\opendental20.2\opendental20.2\OpenDentBusiness\Data Interface\Employees.cs:line 108
   at OpenDentBusiness.Employees.GetEmpsForClinic(Int64 clinicNum, Boolean isAll, Boolean getUnassigned) in C:\Users\wjs\Desktop\ODVersions\opendental20.2\opendental20.2\OpenDentBusiness\Data Interface\Employees.cs:line 295
   at OpenDentBusiness.Employees.GetEmpsForClinic(Int64 clinicNum) in C:\Users\wjs\Desktop\ODVersions\opendental20.2\opendental20.2\OpenDentBusiness\Data Interface\Employees.cs:line 289
   at OpenDentBusiness.Schedules.GetPeriodEmployeeSchedTable(DateTime dateStart, DateTime dateEnd, Int64 clinicNum) in C:\Users\wjs\Desktop\ODVersions\opendental20.2\opendental20.2\OpenDentBusiness\Data Interface\Schedules.cs:line 1677
   at OpenDental.ContrAppt.RefreshSchedulesIfNeeded(DateTime dateStart, DateTime dateEnd, List`1 listOpNums, Boolean isRefreshNeeded) in C:\Users\wjs\Desktop\ODVersions\opendental20.2\opendental20.2\OpenDental\Main Modules\ContrApptJ.cs:line 2963
   at OpenDental.ContrAppt.RefreshModuleDataPeriod(List`1 listPinApptNums, List`1 listOpNums, List`1 listProvNums, Boolean isRefreshAppointments, Boolean isRefreshSchedules) in C:\Users\wjs\Desktop\ODVersions\opendental20.2\opendental20.2\OpenDental\Main Modules\ContrApptJ.cs:line 2950
   at OpenDental.ContrAppt.ModuleSelected(Int64 patNum, List`1 listPinApptNums, List`1 listOpNums, List`1 listProvNums) in C:\Users\wjs\Desktop\ODVersions\opendental20.2\opendental20.2\OpenDental\Main Modules\ContrApptJ.cs:line 2664
   at OpenDental.FormOpenDental.SetModuleSelected(Boolean menuBarClicked) in C:\Users\wjs\Desktop\ODVersions\opendental20.2\opendental20.2\OpenDental\Main Modules\FormOpenDental.cs:line 3605
   at OpenDental.FormOpenDental.SetModuleSelected() in C:\Users\wjs\Desktop\ODVersions\opendental20.2\opendental20.2\OpenDental\Main Modules\FormOpenDental.cs:line 3595
   at OpenDental.FormOpenDental.ProcessCommandLine(String[] args) in C:\Users\wjs\Desktop\ODVersions\opendental20.2\opendental20.2\OpenDental\Main Modules\FormOpenDental.cs:line 6558
   at OpenDental.FormOpenDental.FormOpenDental_Load(Object sender, EventArgs e) in C:\Users\wjs\Desktop\ODVersions\opendental20.2\opendental20.2\OpenDental\Main Modules\FormOpenDental.cs:line 716
   at System.EventHandler.Invoke(Object sender, EventArgs e)
   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.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
   at System.Windows.Forms.UnsafeNativeMethods.SendMessage(HandleRef hWnd, Int32 msg, Int32 wParam, Int32 lParam)
   at System.Windows.Forms.Form.SetVisibleCore(Boolean value)
   at System.Windows.Forms.Control.set_Visible(Boolean value)
   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\opendental20.2\opendental20.2\OpenDental\Main Modules\ProgramEntry.cs:line 90
Because EmployeeCrud.TableToList is expecting these

Code: Select all

				employee.WirelessPhone= PIn.String(row["WirelessPhone"].ToString());
				employee.EmailWork    = PIn.String(row["EmailWork"].ToString());
				employee.EmailPersonal= PIn.String(row["EmailPersonal"].ToString());
				employee.IsFurloughed = PIn.Bool  (row["IsFurloughed"].ToString());
				employee.IsWorkingHome= PIn.Bool  (row["IsWorkingHome"].ToString())
But they aren't in the db yet.

So do I have to wait until these fields are added?
Cheers,

Bill Starck, DDS
Big Idea Software, LLC
Developer, EASy(Electronic Anesthesia System) for Open Dental
817-807-1709
TX, USA

joes
Posts: 239
Joined: Tue Aug 13, 2019 12:41 pm

Re: Annoying plugin build problem

Post by joes » Thu Jul 02, 2020 3:52 pm

Those columns were added to the Employee table in version 20.1.3. If the db has been updated to that version or beyond and those columns are missing, I would suspect that something went wrong with the update, or the db is corrupted. You could try running queries to add those columns to the db, but it is quite possible that other updates to the db are missing. Here are the queries for adding those columns:

ALTER TABLE employee ADD WirelessPhone varchar(255) NOT NULL;
ALTER TABLE employee ADD EmailWork varchar(255) NOT NULL;
ALTER TABLE employee ADD EmailPersonal varchar(255) NOT NULL;
ALTER TABLE employee ADD IsFurloughed tinyint NOT NULL;
ALTER TABLE employee ADD IsWorkingHome tinyint NOT NULL;

If you suspect that other data is missing from the db and you have a sound backup that predates 20.1.3, you could run OD with a copy of the backup db and the update will add these columns.
Joe Sullivan
Open Dental Software
http://www.opendental.com

joes
Posts: 239
Joined: Tue Aug 13, 2019 12:41 pm

Re: Annoying plugin build problem

Post by joes » Thu Jul 02, 2020 4:02 pm

One other possible reason for that error is if the db being used does predate 20.1.3 and the Dynamic Mode check box is checked on the Choose Database window. This will prevent Open Dental from prompting you to update the db.
Joe Sullivan
Open Dental Software
http://www.opendental.com

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

Re: Annoying plugin build problem

Post by jordansparks » Fri Aug 14, 2020 11:01 am

It's pretty common for me to miss a few queries when I'm working from source code. For example, ConvertDatabases6.To20_3_1() might have a number of queries that I already picked up and am using. So my Db thinks it's at 20.3.1. But if it hasn't been publicly released, then it's fair game for someone to come along and add a few more lines to that method. This is true of any version. I can easily miss a few. That's the danger of working from source code. You have to know how to go through those methods and find the queries that got missed. The #.#.1 methods are huge and the most likely source of this problem, but any other version can have exactly the same issue on a smaller scale. The only way to avoid this issue completely is to not use code that you compile.
Jordan Sparks, DMD
http://www.opendental.com

Post Reply