0

Axiom: no screen script compiles on a screen with an asset trend (CS0122 'ControlTrendAsset' is inaccessible)

Product / version: Axiom 26.8.0.26287

Summary

If a screen has a TrendGraph with an asset trend (a trend that follows an asset type, rather than a single tag), that screen's script never compiles. It does not matter what the script contains. Axiom's generated half of the script class declares a field for each asset trend, typed ControlTrendAsset, and that type is not accessible to user scripts. Every handler on the screen is disabled as a result. The screen still renders and the trends still draw.

Errors reported when the application loads

Could not compile script on screen 'Screen2'
CS0122: 'ControlTrendAsset' is inaccessible due to its protection level

There is one pair of CS0122 errors per asset trend on the screen. The line numbers point into the generated code, not into the user's script.

Steps to reproduce

  1. Create a new application.
  2. On Screen1, add a TrendGraph. Set its Asset Type to any asset type, and add one asset trend (one asset tag).
  3. Open the screen script. Leave the default script as it is and add one line to OnScreenVisible(): Log.Info("compiled");
  4. Save the application and reload it.

Expected: the script compiles and "compiled" appears in the messages. Actual: the CS0122 errors above, and the script does not run.

What we isolated (each variant built as its own application, same one-line script):

Screen contentsScript compiles?

TrendGraph with no trends Yes
TrendGraph with one fixed-tag trend Yes
TrendGraph with one asset trend No (CS0122)
The same asset trend with a control name set No. The name is also not kept on save
The same TrendGraph inside a Panel No

It also happens in a production application built in the Axiom editor, with three TrendGraphs and six asset trends (12 errors). So it does not depend on how the application was created.

Impact

Asset trends are the natural way to trend "every well under the selected pad" in an application with an asset picker. Any application that does this cannot use screen scripting on that screen. Our case: hiding a TrendGraph when the selected asset has no matching child assets, triggered by OnEndAssetChange on the screen.

Our current workaround is to put the script on a second, hidden screen. It finds the real screen through Application.Screens and polls its AssetInstance with an EventTimer, because OnEndAssetChange can only be handled by the screen that owns it. This works, but it adds polling and delay, and it is not something we want to leave in place long term.

Requests

  1. Fix the generated script class so that a screen holding asset trends compiles. Either make ControlTrendAsset public, as ControlTrend is, or leave controls of non-public types out of the generated fields.
  2. Until then, is there a supported workaround? In particular, is there a way to run screen script on a screen with asset trends, or for a script to be notified when another screen's asset changes?.

Reply

null

Content aside

print this pagePrint this page
  • 4 hrs agoLast active
  • 2Views
  • 1 Following