Plugin won't load in debugger (customer db)

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:

Plugin won't load in debugger (customer db)

Post by wjstarck » Tue Aug 30, 2022 2:27 pm

I am trying to debug a customer's db that uses our plugin.

I copy the customer's db into my mysql/data folder but the plugin won't load when I try to run OD in the VS2019 debugger. Why?
Cheers,

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

SLeon
Posts: 476
Joined: Mon Mar 01, 2021 10:00 am

Re: Plugin won't load in debugger (customer db)

Post by SLeon » Wed Aug 31, 2022 10:15 am

Hey there,

What is your typical process for creating your debugging environment? Which version of Open Dental are you trying to do this with, and have you been successful with pervious versions?

Lastly, what sort of output/error message display when Visual Studio fails to build in DEBUG mode?

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

Re: Plugin won't load in debugger (customer db)

Post by wjstarck » Wed Aug 31, 2022 10:38 am

I can build OK. It's OD 22.1.55.

Further investigation shows that it's failing here on PluginLoader.cs (see arrow):

Code: Select all

		public static void LoadAllPlugins(Form host) {
			if(Environment.MachineName.ToLower()=="jordanhome" || Environment.MachineName.ToLower()=="jordancryo"){
				bool isAllowed=DatabaseIntegrities.IsPluginAllowed("someplugin.dll");//to simulate loading a dll
			}
			//No need to check RemotingRole; no call to db.
			if(ODBuild.IsWeb()) {
				return;//plugins not allowed in cloud mode
			}
			List<PluginContainer> listPluginContainers=new List<PluginContainer>();
			//Loop through all programs that are enabled with a plug-in dll name set.
			List<Program> listPrograms=Programs.GetWhere(x => x.Enabled && !string.IsNullOrEmpty(x.PluginDllName));
			for(int i=0;i<listPrograms.Count;i++) {
				string dllPath=ODFileUtils.CombinePaths(Application.StartupPath,listPrograms[i].PluginDllName);
				if(RemotingClient.RemotingRole==RemotingRole.ServerWeb) {
					dllPath=ODFileUtils.CombinePaths(System.Web.HttpContext.Current.Server.MapPath(null),listPrograms[i].PluginDllName);
				}
---------------------> if(!DatabaseIntegrities.IsPluginAllowed(listPrograms[i].PluginDllName)){
					DatabaseIntegrity databaseIntegrity=DatabaseIntegrities.GetOnePlugin(listPrograms[i].PluginDllName);
Does it need to be whitelisted at HQ somehow? The plugin loads just fine in that office's production environment, and on my development database on my development server, but it won't load on a copied database from my customer.
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: Plugin won't load in debugger (customer db)

Post by wjstarck » Wed Aug 31, 2022 10:57 am

NVM, I was able to find a workaround:

Just replacing the code in DatabaseIntegrities.Refresh from HQ like so worked.

Code: Select all

		private static void RefreshFromHQ(){
			_listDatabaseIntegrities=new List<DatabaseIntegrity>();
#if DEBUG
---------------------->			//OpenDental.localhost.Service1 service1=new OpenDental.localhost.Service1();
#else
				OpenDental.customerUpdates.Service1 service1=new OpenDental.customerUpdates.Service1();
				service1.Url=PrefC.GetString(PrefName.UpdateServerAddress);
#endif
---------------------->			OpenDental.customerUpdates.Service1 service1 = new OpenDental.customerUpdates.Service1();
Cheers,

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

SLeon
Posts: 476
Joined: Mon Mar 01, 2021 10:00 am

Re: Plugin won't load in debugger (customer db)

Post by SLeon » Wed Aug 31, 2022 11:05 am

Edit: I am glad you found a work around. I am leaving the below information in case others find it useful.

Yes, as of 21.4 all plugins must be whitelisted here at Open Dental HQ. However, if the dental office is able to use your plugin, it is already whitelisted. This whitelisting check is based on the exact match of the dll name, so the filename of the dll you are testing must be the same as the one used by the dental office. I have just verified that we have a Big Idea Software plugin whitelisted, but you are welcome to private message me the exact name of your desired dll to verify specifically.

Could you please clarify if the solution is throwing at the point indicated at the arrow, or if you are seeing a message box when starting Open Dental stating plugins were unable to be loaded?

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

Re: Plugin won't load in debugger (customer db)

Post by wjstarck » Wed Aug 31, 2022 1:28 pm

I don't see any error window it just silently fails and won't load the plugin.
Cheers,

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

User avatar
jsalmon
Posts: 1551
Joined: Tue Nov 30, 2010 12:33 pm
Contact:

Re: Plugin won't load in debugger (customer db)

Post by jsalmon » Fri Sep 02, 2022 1:39 pm

We have code like this sprinkled throughout the program on purpose; So that we don't automatically connect to our live services when we are developing. Your users should never run into this problem since they should be using a version of Open Dental that was compiled in Release mode.
The best thing about a boolean is even if you are wrong, you are only off by a bit.

Jason Salmon
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: Plugin won't load in debugger (customer db)

Post by wjstarck » Thu Feb 16, 2023 12:24 pm

OK thanks.

Not the end of the world, but definitely annoying :x
Cheers,

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

Post Reply