Skip to content

DYNAMICTEXT Attribute binding inside LISTVIEW is silently dropped, leaving orphaned template parameter and causing Studio Pro NullReferenceException #650

Description

@kovacoj

Summary

When a DYNAMICTEXT widget inside a LISTVIEW is created or modified through mxcli with an attribute binding, mxcli reports success, but the binding does not appear to be persisted correctly.

The resulting page keeps a text template such as:

Content: '{1}'

but the corresponding attribute/template parameter binding is missing.

This leaves an orphaned template placeholder and causes Mendix Studio Pro to throw a System.NullReferenceException when opening/selecting the affected widget in the page editor.

This looks like a validation/persistence issue in mxcli: either the binding should be persisted correctly, or mxcli should reject the unsupported syntax with a clear validation error. It should not silently write a broken model state.

Environment

  • Mendix Studio Pro version: 10.23.0
  • mxcli version: nightly (2026-06-07T12:42:15Z)
  • Context: mxcli used through OpenCode
  • OS: TODO: add your OS here, e.g. Windows 11 / WSL / Linux / macOS

Steps to reproduce

  1. Create or modify a page containing a LISTVIEW.

  2. Inside the list item template, add a DYNAMICTEXT widget intended to display an entity attribute, for example:

    DYNAMICTEXT txtFirstName (
      Attribute: Firstname
    )
    

    or equivalently a dynamic text template using content parameters, for example:

    DYNAMICTEXT txtFirstName (
      Content: '{1}',
      ContentParams: [{1} = Firstname]
    )
    
  3. Run mxcli validation/check.

    mxcli check
  4. Run the mxcli command that writes the model.

    mxcli exec <script-or-command>
  5. Re-describe or inspect the affected page after the write.

  6. Observe that the persisted widget no longer contains the attribute/template binding. It only keeps something equivalent to:

    DYNAMICTEXT txtFirstName (
      Content: '{1}'
    )
    
  7. Open the project in Mendix Studio Pro 10.23.0.

  8. Open the affected page and select/click the affected Dynamic Text widget.

Expected behavior

mxcli should do one of the following:

  1. Correctly persist the attribute binding / template parameter binding for DYNAMICTEXT inside LISTVIEW.

    For example, if the input is:

    DYNAMICTEXT txtFirstName (
      Attribute: Firstname
    )
    

    then the generated Mendix model should contain a valid Dynamic Text value bound to Firstname.

  2. Or, if this syntax/context is not supported yet, mxcli check or mxcli exec should reject it with a clear validation error.

mxcli should not write a partial text template containing {1} without the corresponding parameter binding.

Actual behavior

mxcli accepts the model and reports success.

However, the generated/persisted model appears to drop the actual attribute/template parameter binding and keeps only the text template placeholder:

Content: '{1}'

without the corresponding parameter binding.

This creates an invalid/orphaned template parameter state. Studio Pro then throws a null reference error when opening/selecting the affected widget.

Observed Studio Pro error:

System.NullReferenceException
at ClientTemplateFormPart.CollectControls

Impact

This is high impact because mxcli silently writes a model state that Studio Pro cannot handle correctly.

The failure is difficult to diagnose because:

  • mxcli check passes or does not report the missing binding.
  • mxcli exec reports success.
  • The error only appears later in Studio Pro.
  • The model looks superficially valid because Content: '{1}' is still present.
  • Studio Pro appears to cache the broken model state until fully closed and reopened.

Workaround

Replacing affected DYNAMICTEXT widgets with plain static text avoids the crash:

DYNAMICTEXT txtFirstName (
  Content: 'Employee Record'
)

After replacing the affected widgets with plain static Content: values and fully closing/reopening Studio Pro, the NullReferenceException no longer occurs.

The downside is that list items show placeholder/static text instead of data-bound values, so the bindings have to be restored manually in Studio Pro's page editor.

Related issue

This may be related to the same class of issue as #547, where template parameters were silently dropped during round-trip. This report concerns DYNAMICTEXT inside LISTVIEW.

Suggested acceptance criteria

  • DYNAMICTEXT inside LISTVIEW round-trips losslessly when using attribute/template parameter bindings.
  • Content: '{1}' is never persisted without the corresponding parameter binding.
  • mxcli check detects orphaned template placeholders such as {1} with no parameter binding.
  • If Attribute: or ContentParams: is unsupported for this widget/context, mxcli rejects it with a clear validation error instead of writing a broken model.
  • Opening/selecting the affected widget in Studio Pro 10.23.0 no longer causes System.NullReferenceException.

Additional notes

I am reporting this as a user of mxcli through OpenCode, not as someone who has inspected the mxcli internals. The observed behavior strongly suggests that the binding is dropped during mxcli validation/persistence/round-trip, but I may not have identified the exact internal root cause.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions