Debugging a script with Visual Studio
To debug using either of the procedures described here, WinStudio must be configured to use Visual Studio. You can then use Visual Studio to debug either interactively or modally.
The procedures described in this topic 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.
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 an application domain (in this case the global script domain or the form script domain), the only way it can be unloaded is to unload the domain. To unload a global script, select the WinStudio menu command Form > Definition > Unload all Global Form Objects. To unload a form script, close the form and reopen it. 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.