Skip to content

10-odata-examples.mdl Level 9.1 crashes Studio Pro project check (NRE in CallExternalAction.SchemaAction) #590

@ako

Description

@ako

Summary

Running mdl-examples/doctype-tests/10-odata-examples.mdl against a project leaves the project in a state that crashes Studio Pro's background project checker with a System.NullReferenceException in Mendix.Modeler.Integration.CallExternalAction.get_SchemaAction().

The crash blocks all in-IDE error reporting (the checker dies before reporting any problems), so the project appears 'silent' even though Studio Pro is actually unable to evaluate it.

Stack trace

System.AggregateException: One or more errors occurred. (Object reference not set to an instance of an object.)
 ---> System.NullReferenceException: Object reference not set to an instance of an object.
   at Mendix.Modeler.Integration.CallExternalAction.get_SchemaAction()  CallExternalAction.cs:35
   at Mendix.Modeler.Integration.ExternalActionParameterMapping.get_SchemaParameter()  ExternalActionParameterMapping.cs:23
   at Mendix.Modeler.Integration.ExternalActionParameterMapping.Check(IProblems problems)  ExternalActionParameterMapping.cs:40
   at Mendix.Modeler.Storage.TypeWalks.TypeWalk.ForEachObjectDo[TObject](...)
   ...
   at Mendix.Modeler.Core.View.Problems.BackgroundCheckRunner.Check(IProject project, CancellationToken)

Root cause

The example file's Level 9.1 generates a microflow OdTest.ACT_CallExternalAction containing two call external action activities against OdTest.SalesforceAPI:

$Result = call external action OdTest.SalesforceAPI.GetAccounts(status = 'active', Region = $SelectedRegion);
call external action OdTest.SalesforceAPI.NotifyUpdate(AccountId = $AccountId) on error continue;

OdTest.SalesforceAPI is created in Level 8.1 with MetadataUrl: 'https://api.salesforce.com/odata/v4/$metadata' — a placeholder URL that doesn't actually return an OData $metadata document. After CREATE ODATA CLIENT, the resulting Rest\$ConsumedODataService BSON has:

{
  \"Metadata\": \"\",
  \"MetadataHash\": \"\",
  \"Validated\": false,
  \"MetadataReferences\": [0],
  \"ValidatedEntities\": [0],
  ...
}

i.e. the cached \$metadata schema is empty.

When Studio Pro's ExternalActionParameterMapping.Check() runs, it walks via Action.SchemaAction.Parameters[…]. SchemaAction is computed by looking up Name against the consumed service's cached schema actions — with an empty cache, the lookup returns null. Studio Pro then dereferences null instead of reporting a missing-action problem, and the entire background checker aborts.

By contrast, TripPinClient.TripPinApiClient (also in the file, Level 10.1) points at the reachable TripPin RW service, so its Metadata field holds the full $metadata XML, and any actions called against it would resolve correctly.

Two responsible parties

  1. The MDL example file references actions on a service whose \$metadata never resolves. Even if Studio Pro null-checked, the resulting model would still be broken-but-checkable.
  2. Studio Pro (CallExternalAction.get_SchemaAction / ExternalActionParameterMapping.Check) should null-check and report a real problem (e.g. "schema action `GetAccounts` not found in service `OdTest.SalesforceAPI`") rather than NREing and killing the checker. This is an upstream robustness gap — would be useful to file with Mendix support.

Scope of this issue

Fix the example file (rewrite Level 9.1 to use TripPinClient.TripPinApiClient and real TripPin schema actions: GetNearestAirport for the parameterised variant, ResetDataSource for the on error continue variant). The Studio Pro NRE is tracked separately as something to escalate upstream — this issue does not block on it.

Steps to reproduce

  1. Open any blank Mendix 11.x project.
  2. Run mxcli exec mdl-examples/doctype-tests/10-odata-examples.mdl -p <project>.mpr.
  3. Open the project in Studio Pro.
  4. Wait for background project check to run.
  5. Observe System.NullReferenceException aborting the checker.

Expected behaviour

The example file should produce a project that opens cleanly in Studio Pro and yields valid model checks (possibly with warnings, but no NRE).

Environment

  • mxcli version: tip of main (commit cf0ab070)
  • Mendix version: 11.x (test6 fixture at 11.10.0)
  • Reference data: /workspaces/ModelSDKGo/mx-test-projects/test6-app

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions