System.Diagnostics.Debugger.Launch();
System.Diagnostics.Debugger.Launch()
Scott.Pearce wrote:OK. Se let's take a look at a standard VB plugin that is enabled in the demonstration database.
Assumptions:
Jiwa 7.2.1 SR11 is installed.
A fresh copy of the Jiwa demonstration data has been created.
At least one debugger is installed. This example will use Visual Studio 2022.
Log into the demo data:
Load Plugin Maintenance from "System Settings->Plugins->Plugin Maintenance":
Use the "Search" to find the "Move Lines to New Order" plugin:
Now, this particular plugin adds a button to the "Utilities" tab on the menu ribbon of the sales order entry screen ("Sales->Order Entry" from the menu) with the caption "Move lines to a new order". I know this by reading the plugin description. But I can also infer this. Look at the "Forms" tab of the plugin - there is an entry for "Sales Orders". This means that this plugin will load when the sales order entry form is loaded. Now look at the "Code" tab of the plugin and examine the "Setup" function in the "FormPlugin" class - here we see that a button is created and added to the ribbon menu, and a handler added to fire when the button is clicked.
Let's say we want to be able to step through the code of this plugin right from the start. Important point - for any form that appears on the "Forms" tab of the plugin, the "SetupBeforeHandlers" function of the "FormPlugin" class is called when that form is loaded by the user. This is the very earliest starting point of the plugin. Following that call, a call into "Setup" of the "FormPlugin" class is made. I am going to insert the debugger launch code into the "SetupBeforeHandlers" function of the "FormPlugin" class:
- Code: Select all
System.Diagnostics.Debugger.Launch()
Now click the "Compile" button on the code tab toolbar and ensure no compile errors occur. Save the plugin, log out and back into Jiwa so that your code change is compiled. Now whenever you launch the sales order entry form, you will be presented with this dialog:
Select the debugger you wish to use via the dialog and then click OK. Your debugger will now load and be waiting to step from the "System.Diagnostics.Debugger.Launch()" line of code we inserted:
I'm now in a normal Visual Studio development environment. I'm going to set a breakpoint in the "Setup" function, and the press "Continue". Now I've hit my breakpoint:
From here I can step through the code, examine variable values, etc. just as if I was running the plugin code natively in the IDE. I hope this gets you started in the wonderful world of Jiwa plugin debugging.
Thanks for your reply. This is really helpful but why there is no any documentation or tutorial regarding these types of things.
sagharfrancis wrote:Thanks for your reply. This is really helpful but why there is no any documentation or tutorial regarding these types of things.
Return to Technical and or Programming
Users browsing this forum: No registered users and 9 guests