Including open/close curly brackets (braces) with any text in between, on a commented line (e.g. #{z}
), in a value changed event script, on a tag in a udt definition... causes the script to fail silently showing no errors in the script editor and no errors in the logs.
Any of these lines causes silent failure of the script with no lines executed.
#{L}
# here is an innocuous comment that should not affect anything but {does}
I tested for the same on atomic tags not in a udt definition/instance and that does not appear to have the same issue.
I suspect this relates to the fact that there are a few valid parameters that can be use inside a UDT definition/instance so a pre-processor might be attempting map anything bounded by curly brackets as a parameter reference. I suspect the same silent error mode might occur for any text bounded by braces that is not a valid parameter reference; commented line or not (untested).
Suggested resolutions for Ignition developers to consider:
- Do not evaluate comment lines/text for parameter references.
- In the event of an invalid parameter reference provide suitable errors in the logs instead of failing silently.
I ran into this while building a udt definition to pull data from api.weather.gov. I copied some text from the general-faqs page as script comments...
# Retrieve the metadata for your location from https://api.weather.gov/points/{lat},{lon}.
# For our example the URL will be https://api.weather.gov/points/38.8894,-77.0352
...and my scripts started to fail silently, it took some time (line by line elimination) to understand why. I was not expecting a commented out line to impact the script execution like this.
Posting here in an effort to save others the same head scratching and hopefully improve the product by prompting a bug fix.
Ignition v8.1.31
@PGriffith
@Kevin.Herron