Adding the expressions 'Geometry($feature).x' and 'Geometry($feature).y' on a map service layer pop-up returns the following error message, "Runtime Error: Cannot call member method on null", if the service has multiple layers when added to a web map.
Add the layers that need the geometry expression for the pop-up individually to the web map, instead of adding the entire service at once. The individually added layers returns the correct results from the expression.