Plugin Framework Enhancment

This forum is for programmers who have questions about the source code.
Post Reply
User avatar
drtech
Posts: 1649
Joined: Wed Jun 20, 2007 8:44 am
Location: Springfield, MO
Contact:

Plugin Framework Enhancment

Post by drtech » Mon Aug 01, 2011 3:56 pm

I would like to suggest and enhancement that could be made to the plugin framework that would make things smoother when errors or incompatibilities are encountered.
With almost every major version upgrade (and a few minor versions) my plugin crashes OD with an unhandled exception because code changes and makes mine obsolete until I update it. If I can find it and fix it quickly, then everything works pretty well, but if I happen to update and only then find out that the plugin is not compatible, it will not run without disabling the program and loosing all functions of the plugin.

Could we make every hook return with an exit code of 1 or 0 for error handling? If successful , then 1 would be returned nothing would be different than it is now. However, if 0 (failure) then the regular code will execute and that part of the plugin's function will not work, but the program will not crash. A corresponding notification would have to appear to alert the user to still upgrade the plugin, but one that is not annoying and recurring too often. I was thinking a notification tray popup bubble that would appear on the initial error and then once a day remind you that there is a plugin error and it needs to be upgraded?

It seems like this would be a simple addition to the framework and would really help people use plugins as currently they are scared to use them for fear of it crashing on upgrades. What is the feasibility of doing this? (All plugins would have to be updated of course to comply)
David Fuchs
Dentist - Springfield, MO
Smile Dental http://www.887-smile.com

User avatar
drtech
Posts: 1649
Joined: Wed Jun 20, 2007 8:44 am
Location: Springfield, MO
Contact:

Re: Plugin Framework Enhancment

Post by drtech » Fri Aug 12, 2011 3:27 pm

Jordan, is this possible for you to implement? I think it would be very helpful for plugin usage/development.
David Fuchs
Dentist - Springfield, MO
Smile Dental http://www.887-smile.com

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

Re: Plugin Framework Enhancment

Post by jordansparks » Sat Aug 13, 2011 12:55 pm

So you must be talking about PluginBase.cs, line 23, HookMethod. You refer to the "regular code", so I think you must be talking about HookMethod rather than HookAddCode.

PluginBase is an abtract class with a virtual method. So you make your own class that inherits from PluginBase and optionally implement the method. In your method, can't you just put a try/catch in there and return false if it hits the catch? I'm not quite sure what you are suggesting that could possibly improve upon that. If you want something else than what I just suggested, can you give me a filename, line number, and suggested change?
Jordan Sparks, DMD
http://www.opendental.com

Post Reply