The procedures described in this topic apply to form scripts, but
the main steps apply equally to global scripts.
To debug a script using Visual Studio:
- Open a form and enter Design Mode.
- On the Edit menu, click Script Editor.
- In the WinStudio dialog box Editing Script in Visual
Studio, select the Compile for Debug check box.
- Set a break point on the desired line in the script in
the Visual Studio debugging session.
- Under the Visual Studio Debug menu in the debugging
session, click Attach to Process.
- Select an instance of the WinStudio.exe process whose Type
is TSQL, Managed, x86 and whose Title is Editing
Script in Visual Studio.
- Click Attach.
- Minimize the Visual Studio debugging session.
- Perform an action in the form that calls the script.
When the script is called and the breakpoint is encountered,
focus changes to the Visual Studio debugging session attached
to WinStudio. From this point, you can debug the script as
you would debug any VB.NET code.
- When you are done debugging, on the Debug menu in
the Visual Studio debugging session, click Stop Debugging.
- Close Visual Studio.
- Save the form definition.
Modal Debugging
This section describes the debugging process if you clear Modeless
dialog in the Settings
window.
To debug a script with WinStudio, you create
a separate debugging session in Visual Studio 2010, attach the
WinStudio process, and then call the script in WinStudio run mode.
You can then debug the script in the debugging session.
To debug a script using Visual Studio:
- Open a form and enter Design Mode.
- On the Edit menu, click Script Editor.
- Close the Visual Studio IDE.
- In the WinStudio dialog box Editing Script in Visual
Studio, select the Compile for Debug check box.
- Click Debug.
If the script compiles successfully, it opens in another instance
of Visual Studio, a "debugging session."
- Set a break point on the desired line in the script in
the debugging session.
- Under the Visual Studio Debug menu in the debugging
session, click Attach to Process.
- Select an instance of the WinStudio.exe process whose Type
is TSQL, Managed, x86 and whose Title is Editing
Script in Visual Studio.
- Click Attach.
- Minimize the Visual Studio debugging session.
- Click OK to close the Editing Script in Visual
Studio dialog box.
- Exit WinStudio Design Mode.
- Perform an action in the form that calls the script.
When the script is called and the breakpoint is encountered,
focus changes to the Visual Studio debugging session attached
to WinStudio. From this point, you can debug the script as
you would debug any VB.NET code.
- When you are done debugging, on the Debug menu in
the Visual Studio debugging session, click Stop Debugging.
- Close Visual Studio.
- Save the form definition.
Notes about Debugging
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 the following:
- In the WinStudio script
editor:
"Unable to write output file 'C:\Documents and Settings\UserName\Local
Settings\Application Data\Infor\WinStudio\GlobalScripts\ScriptName.dll.'"
- In the Editing Script in
Visual Studio dialog box:
"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.