RAB 5.08: Troubleshooting Null RapidData References

Erik Lindqvist2 min read
ABBRoboticsTroubleshooting
Licensed PE Working through this on a live machine? A Maine-licensed engineer can take it from here — included with IMD hardware, by the hour for everything else. Book an engineer

Observed RAB 5.08 Failure

The application runs in VFPU 5.08, and an ABB Label can bind to RAPID data through a RapidDataBindingSource. Direct access fails with Object reference not set to an instance of an object when the button handler attempts to retrieve T_ROB1/MainMod/nCurrHeight. The RAPID symbol is declared as PERS num.

This exception identifies a null object reference in the client code path; it does not prove that the PERS num declaration is invalid. The evidence does not identify which reference is null, so the failing expression must be separated and inspected before changing the RAPID declaration or API path.

Isolate the Null Reference

  1. Set a breakpoint on the first statement in Button9_Click and step through the handler one statement at a time.
  2. Split the chained lookup into task, module, and data operations so the debugger can identify the first operation that returns no object or throws the exception.
  3. Inspect AeroController, the result of GetTask, the result of GetModule, and the final RapidData reference at each step.
  4. Call ToString() only after confirming that the returned RapidData reference is not null.
Private Sub Button9_Click(ByVal sender As System.Object, _
                          ByVal e As System.EventArgs) Handles Button9.Click
    Dim MyTask = AeroController.Rapid.GetTask("T_ROB1")
    Dim MyModule = MyTask.GetModule("MainMod")
    Dim MyData As RapidData = MyModule.GetRapidData("nCurrHeight")
    TextBox3.Text = MyData.ToString()
End Sub

Interpret the Debug Result

Failure point Supported conclusion Next check
AeroController.Rapid The controller-side object path is unavailable at that statement. Verify that AeroController has been assigned before the click handler runs.
GetTask("T_ROB1") The lookup did not provide a usable task reference. Confirm the exact task name in the running virtual controller.
GetModule("MainMod") The task lookup succeeded, but the module lookup did not provide a usable reference. Confirm that MainMod exists under T_ROB1.
GetRapidData("nCurrHeight") The task and module path succeeded, but the data lookup did not provide a usable reference. Confirm the exact symbol name and that it is declared in MainMod.
MyData.ToString() MyData is null at the conversion point. Trace backward to the lookup that produced it.

MyData is local to Button9_Click, but that scope alone does not explain an exception occurring inside the shown handler. It matters only if other code attempts to use that local reference outside the handler. Treat scope as a separate issue unless step-through debugging shows that the exception occurs elsewhere.

FAQ

Why does GetRapidData fail with “Object reference not set to an instance of an object”?

At least one reference in the controller, task, module, data, or conversion chain is null. Split the chain and inspect each result to identify the exact failure point.

Can RAB 5.08 read a PERS num from T_ROB1?

The evidence shows an attempted lookup of T_ROB1/MainMod/nCurrHeight, but it does not establish why that lookup fails. Verify the initialized controller reference and each named lookup before changing the PERS num declaration.

Does declaring RapidData inside Button9_Click cause the null-reference error?

Not by itself. A local RapidData variable remains valid throughout that handler; scope becomes relevant only if code tries to use the variable after the handler has ended or from another procedure.

Back to blog