DannyC wrote:How can we diagnose the cause?
I'd start by putting some logging into the event log at various points in the plugin to isolate where the cause of the exception is.
E.g.: Scatter something like this around the plugin - before and after things which would be candidates for an exception (such as before and after moving a file, before and after calling the jiwa objects to import, etc).
- Code: Select all
Dim Log As New System.Diagnostics.EventLog("Application")
Log.Source = "Attkey Plugin Diagnostic"
Log.WriteEntry("Checkpoint 1 - Before file copy")
Log.Close()
Once you've found where the problem occurs, put a try catch around the problem code and log to the event log the exception - it might give more information.
Because the file watcher plugin is run in the context of a service, make sure your plugin isn't trying to do something which normally requires a user context - things like displaying message boxes, forms are forbidden, as is emailing using Outlook.
If none of this helps, copy the plugin, modify it to be launched from the menu instead and test to see if the error occurs when not run as a service. If you get to that point and the error still occurs, then you can put a System.Diagnostics.Debugger.Break line in your code and this will have Visual Studio load up and allow you to step through the code to further debug.
Mike