Behavior and limitations
- Additional keywords are not used to access object members. For example, in rules written in .NET languages, the rule context is passed as a parameter named
Context. - Compile .NET assemblies with Microsoft .NET Framework 4.0 or later. You can set the .NET Framework version in your Visual Studio project properties.
- All FlexiCapture objects are COM objects, so .NET scripts can run slower when they access object fields frequently, because of managed-to-unmanaged transitions.
- FlexiCapture objects do not support multithreading.
- After a script is compiled, its compiled body is stored in the same location as the script, so a .NET script can occupy more space than other scripts.
- You can add external assemblies for use in scripts and global modules. Both standard and compiled user assemblies work, and all their classes become available. For more information, see External assemblies.
Namespaces and script objects
FlexiCapture script objects are stored in theControllerInterop.dll and ShellInterop.dll assemblies and belong to the ABBYY.FlexiCapture and ABBYY.FlexiCapture.ClientUI namespaces respectively. The assemblies are located in the root folder of ABBYY FlexiCapture.
All script objects are accessible under their own names from these namespaces. For example:
using directives at the beginning of the script body, together with comments and empty lines. Use the same syntax as in the programming language: using for C#.NET, Import for JScript.NET, and Imports for VisualBasic.NET. For example:
using directive as long as the keyword using appears before the first line of executable code. For example:
Global module functions
In .NET scripts, functions from all global modules are called directly, without the name of the global module. Classes defined in the Rule Global Script Module and in the Export Global Script Module must have different names. Otherwise, an error occurs when you create an instance of the class in rule code. To skip an optional parameter, passSystem.null or System.Type.Missing instead of its value.
Debug .NET scripts
To signal a breakpoint, use the System.Diagnostics.Debugger.Break method. Debugging also requires a*.pdb file with debugging information. This file can be very large, so avoid storing it in the project with your scripts. When you debug a .NET script, specify that the script should be compiled with debugging information.
In Microsoft Visual Studio 2010, you can attach to the process that runs the .NET code.
For scripts that run noninteractively (in the FlexiEx.exe process instead of FlexiCapture.exe), the Debug button is not displayed for the FlexiEx.exe process in the Checking for solution window by default, even for scripts that contain a breakpoint. To display the button, click the Action Center icon on the taskbar and select Change Action Center settings → Problem reporting settings → Never check for solutions.