Using Regex In Scripts
Overview
After upgrading to Activate v8, developers may encounter a "forward to assembly" error when attempting to use regular expressions in scripts.
This occurs because the required .NET library is not automatically imported into the script context.
Symptoms
You may see an error similar to:
- "Forwarded to assembly System.Text.RegularExpressions"
This error typically appears at compile time when a script references Regex or related classes.
Cause
Activate v8 requires explicit imports for certain .NET libraries when used in scripts.
The System.Text.RegularExpressions namespace is not available unless it is explicitly imported.
Resolution
To resolve the issue, add the required import and using statements to the script.
Add the Import Directive
At the top of the script, add the following import directive:
Add the Using Statement
Add the corresponding using statement so the Regex classes can be referenced:
Once both statements are present, the script will compile and Regex functionality can be used as expected.
Notes and Considerations
- This behaviour is specific to Activate v8 and later
- Review existing scripts after upgrade for missing imports
- Similar errors may occur with other namespaces that are not implicitly available