Debugging a script with Visual Studio
You can use the Visual Studio to debug a script either interactively or modally.
The procedures apply to form scripts, but the main steps apply equally to global scripts.
Only one instance of Visual Studio can be attached to WinStudio for debugging.
Using modal and interactive debugging
When you use modal debugging, if you make additional changes to the code you are debugging and attempt a second debug compile of the modified code, you will receive a compile error similar to one of these:
- "Unable to write output file 'C:\Documents and Settings\UserName\Local Settings\Application Data\Infor\WinStudio\GlobalScripts\ScriptName.dll.'"
- "Compile Failed. If script compiles OK when Debug is not checked, try closing and reopening form or doing an unload global objects, and try again."
Compiling for Debug writes an assembly file, along with source and symbols, to disk. The error message indicates that the target assembly file cannot be overwritten because it is currently in use.
In modal debugging, once an assembly is loaded into the global script domain or the form script domain, the only way you can unload the assembly is to unload the domain.
- To unload a global script, you must select the WinStudio menu command .
- To unload a form script, close the form, then reopen the form.
In interactive debugging, unloading form or global objects is not required.
When you use interactive debugging, you can recompile for debug as many times as you want without having to unload the form or global objects.
Initiating a form or global script debug session
You can initiate a form or a global script debug session within Visual Studio by using two different methods:
- Using Visual Studio
Managed Compatibility Mode is required when you attach Visual Studio to a WinStudio instance. Managed Compatibility Mode can be set by using one of two ways:
- You can select under to include Managed Compatibility Mode as an option when attaching to process.
- Alternatively, if Managed Compatibility Mode is not set up under Options, you must verify that Managed Compatibility Mode code is specified in the field. If this code type is not specified, you must click the button and select Managed (v4.6, v4.5, v4.0) and Manage Compatibility Mode codes.
process
- Using Visual Studio
You can use the WinStudio executable file that is added as one of the projects to the EditWinStudioScript Visual Studio solution. To use this option, you must right-click on and select . In the Attach and Use Legacy Managed Engine fields, specify Yes.
option within Visual Studio to start a debug session. This option leverages theWith this setup, you can use the Use Legacy Managed Engine option does the same process by using the legacy debug engine.
option to automatically attach the project to the existing WinStudio process. The
debugging