Page 1 of 1

Plugin won't load in debugger (customer db)

Posted: Tue Aug 30, 2022 2:27 pm
by wjstarck
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?

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

Posted: Wed Aug 31, 2022 10:15 am
by SLeon
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?

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

Posted: Wed Aug 31, 2022 10:38 am
by wjstarck
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.

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

Posted: Wed Aug 31, 2022 10:57 am
by wjstarck
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();

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

Posted: Wed Aug 31, 2022 11:05 am
by SLeon
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?

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

Posted: Wed Aug 31, 2022 1:28 pm
by wjstarck
I don't see any error window it just silently fails and won't load the plugin.

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

Posted: Fri Sep 02, 2022 1:39 pm
by jsalmon
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.

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

Posted: Thu Feb 16, 2023 12:24 pm
by wjstarck
OK thanks.

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